Jump to content


Borland Builder C++ ImpulseC simulations


  • You cannot reply to this topic
1 reply to this topic

#1 csullender

    Member

  • Members
  • PipPip
  • 11 posts

Posted 11 September 2006 - 11:57 AM

I am developing video processing algorithms using
ImpulseC in Borland Builder C++. Here are the steps
for running ImpulseC in Borland in case anyone is interested.

-----------------------------------------------------------

Use coff2omf.exe (supplied with Borland Builder) to convert ImpulseC.lib to omf format.
Add ImpulseC.lib to your Borland project.
Add ImpulseC Include directory and Libraries directory to Borland Project directories.
Modify co.h. Add “extern "C"“ as below:
-------------------------------------------
#ifdef __cplusplus
extern "C"
{
#endif

// Processes and architectures
//

(… Body of co.h …)

#ifdef __cplusplus
}
#endif

#endif // CO_H

-------------------------------------------

I have not found out how to log messages from the ImpulseC
processes directly to Borland visual objects.

Instead of using cosim_logwindow, I tried:

1. thread-safe strings. StringList can be written from multiple
processes.
Example:
TStringList* HW_Log; // Global declaration
HW_Log->Add(s); // Call from any thread.
The strings can be viewed after the simulation is over.

2. a console window same as cosim_logwindow (code below).
The routine "console(String text)" can be called from multiple processes.
The text prints to the console window during simulation.

//---------------------------------------------------------------------------
HANDLE hConsole;
void createConsole(void)
{
char title[256] = " Hardware Processes";
AllocConsole();
hConsole = CreateFile("CONOUT$", GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
SetConsoleMode(hConsole, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
SetConsoleTitle(title);
HWND hwndname = FindWindow("ConsoleWindowClass", title);
SetWindowPos(hwndname, NULL, 0, 0, 500, 260, SWP_SHOWWINDOW);
}
void console(String text)
{
unsigned long size;
text += "\n";
WriteConsole(hConsole, text.c_str(), strlen(text.c_str()), &size, NULL);
}
void closeConsole(void)
{
FreeConsole();
hConsole = NULL;
}
//---------------------------------------------------------------------------

#2 RalphBodenner

    Advanced Member

  • Admin
  • PipPipPip
  • 348 posts

Posted 11 September 2006 - 06:51 PM

Thanks for posting!
Ralph Bodenner
Impulse Accelerated Technologies, Inc.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users