Using Windows Functions in VCC

The Windows header file windows.h can be included in white box c and black box cpp as normal. This is made possible thanks to Andy merging the Windows headers with VCCs, accomplished by simple copying all the MSDN headers (i.e. Visual C++) to a Cadence directory.
Unfortunately, the version of MSDN used was from 98 and as such were outdated (considering the web based documentation was 4 years ahead). The files couldn't be updated as by the time this problem was discovered code belonging to other people was dependant on the old versions. ( I was unwilling to risk breaking their code).

The next project should update the header files before beginning. This can be accomplished using Andy's method (a backup of the original VCC headers exist) or restoring the original headers and specifying the MSDN include directory in the 'includeDirs' parameter of the properties for each behaviour. The latter option is a little tedious but I'm unaware of any other way to add directories to the VCC compiler.

The University has a Microsoft subscription and the MSDN CD's can be obtained from Archie Howitt at the time of writing.

Coding for Windows and VCC

VCC allows for the use of static and dynamic libraries and (seems) to use a Microsoft based linker similar to one included with Visual C++ 6.0. Building a library in Visual C++ is a much more rewarding experience than attempting to use VCC's stripped down version so this feature was invaluable. Of course getting it to actually work is another matter!

The pipe communication base classes are common to both the Windows application and the VCC model. By compiling them into a static library, code was no longer required to be duplicated reducing potential source control problems.

How to use VC++ 6 Libraries in VCC

For an easier life make sure that the compilation (in VC++ 6) of your library has code optimisations set to default or debug. The differences between VC++ 6 and VCC can cause weird and wonderful errors otherwise.
Write a single header file for the library (see vccStub.h for an example). This isn't used in the compilation of the library but it much easier to include a single .h file in VCC than a whole batch.
Once you've prepared the library and main header file they should be moved to a easily reachable directory.

VCC Properties

All that's left is to include your .h file in your black box model and tell VCC where to look for the .lib file. To do this right click in your code window in VCC and set the parameters. Each parameter is a semicolon delimited list of values.

These parameters need to be set for each model that requires the libraries so it pays to stay consistent.

next


Copyright © 2002 James Brown
Last Updated Fri, 3/5/02