I am using Visual Studio 2010 to create a DLL.
And another programmer who uses Visual Studio 2005 wants to use my DLL. It can compile with my dll, but when the application starts, it just crashes with the exception of bad_alloc. I guess because of a different version of CRT.
When creating my DLL, I tried both dynamic CRT (/ MD) binding and static CRT (/ MT) binding, but both failed.
So, can I create a DLL that can be used by a lower version of visual studio? If not, how can I do this?
, dll-. memmory , , , . .
:
extern "C" __declspec(dllexport) void doSomething(int input);
: DLL DLL CRT. ( , DLL V++ 2005), V++ 2005, V++ 2010.
( ) , , dll. http://chadaustin.me/cppinterface.html .
VS2005, Platform Toolset VS2010 VS2005.
Platform Toolset
Project Properties → General → Platform Toolset. VS100 - vs2010, VS90 2008 ( ) VS80 - , ( 2005...).
Project Properties
General
AFAIK, DLL-, , ( , ).
, (, ++), V++, DLL DLL, V++, , .
DLL (V++ 8.0 VS2005, V++ 9.0 2008, V++ 10.0 2010...), . Visual Studio, , .
, COM. :
2 Dll
a. GetExportedClass which returns a pointer to a new instance of CExportedClass upcast to IExportedFunctionality*. b. FreeExportedClass which accepts a IExportedFunctionality* and deletes it.
IExportedFunctionality. lib, LoadLibrary GetProcAddress GetExportedClass FreeExportedClass.
. IExportedFunctionality