C Runtime Library DLL
List of: Discussion Topic
Subjects: Building Applications, SAT Save and Restore
Contents: Application Development Manual

When using the ACIS DLLs, it is important that you link your application against the DLL version of the C Runtime Library. Otherwise you will have two separate versions of the runtime library. Files opened (using fopen) by the C runtime library in your executable will not be recognized by the C runtime library used by ACIS and other DLLs. If you use the DLL version of the C Runtime Library, it will be shared by the executable and all DLLs.

You must also make sure that you do not use two different C runtime DLLs (e.g., one release and one debug) when using ACIS. When two different runtime DLLs are in use, several problems can occur. One problem is that file pointers can not be shared between two runtime DLLs. Each C runtime DLL has its own collection of file pointers (FILE*), and one C runtime DLL will experience an access violation if it tries to work with another's file pointer. Another problem is that memory allocated by one C runtime DLL can not be deleted by another C runtime DLL, since each has its own memory heap.

A common case in which two different C runtime DLLs are used is the mixing of the debug and release versions of the C runtime DLLs. For example, if your application is built with the debug version of the C Runtime Library DLL (msvcrtd.dll), and your ACIS DLLs use the release DLL version (msvcrt.dll), then you will experience problems. This is a frequent source of access violations for save and restore.

You can determine which C runtime DLL is used by any DLL or executable file using the dumpbin program, which is part of the Visual C++ distribution. For example, to check your application executable, use (substitute the correct name of your application):

dumpbin /imports application.exe | findstr /i dll

To check your ACIS binaries, use (substitute the correct name/version of your Kernel DLL):

dumpbin /imports kern60.dll | findstr /i dll

If the result shows msvcrt.dll, that means the release DLL is used; if it shows msvcrtd.dll, that means the debug DLL is used (the added "d" means "debug version"). If one is using the release DLL and the other is using the debug DLL, you need to change either your application or your ACIS binaries so that they use the same C runtime DLL.
PDF/APPDEV/03LIB.PDF
HTM/DATA/ACIS/APPDEV/03LIB/0008.HTM