Mixing Static Libraries of C Code built from different versions of Visual Studio 2002 and later

后端 未结 1 1808
隐瞒了意图╮
隐瞒了意图╮ 2020-12-22 00:25

I have a static linkable library of C and Fortran routines compiled and linked together using the Visual Studio 2002 C (v7.0) Compiler and the Intel Fortran 9.0.018 Compiler

相关标签:
1条回答
  • 2020-12-22 00:59

    Mixing C runtimes hasn't worked for me in the past. The only manner in which I can see this working {maybe} is if you're completely isolating the use of the stack/heap within the boundaries of the statically linked C-Runtime [nothing crosses boundaries via parameters but then what value is your vs2009if9.lib providing].

    As an example, if you're to be allocating a pointer [heap memory] within the application and passing this pointer to the library you provided, which heap manager should be used? The correct answer is the heap manager managing the pointer, but your library won't know about the other heap manager. It gets uglier if your library allocates memory for use by the application and it's the applications responsibility to free/delete using the provided pointer (bad design yes but still possible). Again, the wrong heap manager will be utilized.

    0 讨论(0)
提交回复
热议问题