HowTo:Mix debug and non-debug libraries on Windows

From DocR21

Jump to: navigation, search



No compilation flag changes are necessary when mixing debug and non-debug libraries. The incompatibility with mixing the debug and non-debug libraries is due to using a different version of the msvcrt system library. As you probably know, this library is responsible for system memory allocation and file I/O. If you can force the allocation and file I/O to go to a single version of the msvcrt, then you can mix the libraries for debugging purposes.

ACIS provides a means of forcing the allocators, destructors, and file pointers to come from the msvcrt on which ACIS was built.

To implement this, first you need to specify a raw allocator and destructor. This can be done by calling initialize_base before calling api_start_modeller, as shown below:

base_configuration mixed_base_config;
mixed_base_config.raw_allocator = malloc;
mixed_base_config.raw_destructor = free;
 
initialize_base(&mixed_base_config);
 
api_start_modeller(0);

Second, you need to force the file pointers through the msvcrt version ACIS was built against. To do this you must replace any fopen and fclose functions with acis_fopen and acis_fclose functions. These functions have the same signatures as the system functions and are simply wrappers for the system functions. They are exported through the acisio.h header file. (For Microsoft Windows applications there is also a acis_wfopen function.)

Note: Mixing libraries would not be recommended for a production build. This may be done in debugging situations only, for instance if you wish to have the performance of production ACIS libraries while debugging your application code.


See Also

Personal tools
Live