Mixing static C code libraries built from different versions of Visual Studio 2002 and later

I have a static linking library of C and Fortran routines compiled and linked to each other using Visual Studio 2002 C compiler (v7.0) and Intel Fortran compiler 9.0.018.

C code in my library calls and links to Microsoft C-RunTime Static Libraries (MSCRT) 2002 (single-threaded). I believe the actual version number of the 2002 CRT libraries is v7.0

I will reference this static library as "vs2002if9.lib"

Is it possible to statically reference my "vs2002if9.lib" safely using any later version of Visual Studio (2003, 2005 or 2008) without any worries about how the calling program behaves with respect to C runtime calls?

Or am I creating problems by mixing a version of the static CRT libraries?

What if I provide my "vs2002if9.lib" to third-party software developers? What requirements do I impose on them?

+1
source share
1 answer

Time Lapse C has not worked for me in the past. The only way I can see that this works, perhaps, is that you completely isolate the use of the stack / heap within the boundaries of the statically linked C-Runtime [nothing crosses borders through parameters, but then what does your vs2009if9 matter .lib provides].

As an example, if you want to select the [heap memory] pointer in the application and pass that pointer to the library you provided, which heap administrator should I use? The correct answer is a heap manager that manages the pointer, but your library will not know about another heap manager. It becomes more ugly if your library allocates memory for use by the application, and it is the responsibility of the applications to free / delete using the provided pointer (poor design, yes, but still possible). Again, the wrong heap manager will be used.

+2
source

All Articles