我可以在 Visual Studio 2008 中使用 Visual Studio 6 编译的 C++ 静态库吗?
问题描述:
是否可以在 Visual Studio 2008 中使用使用 Visual Studio 6 编译的 C++ 静态库 (.lib)?
Is it possible to use a C++ static library (.lib) compiled using Visual Studio 6 in Visual Studio 2008?
答
我不应该想为什么不 - 只要你保持通常的 CRT 内存边界(即如果你在库函数内部分配内存,总是从在库内部 - 通过调用库中的函数来进行释放).
I shouldn't think why not - as long as you keep the usual CRT memory boundaries (ie if you allocate memory inside a library function, always free it from inside the library - by calling a function in the lib to do the freeing).
这种方法适用于用各种编译器编译的 dll,静态链接的库也应该可以.
this approach works fine for dlls compiled with all kinds of compilers, statically linked libs should be ok too.