Link DLL with Visual C++ not working
I have the following problem:
I have a dll compiled with MinGW and a header file that describes the DLL exports. I want to use this DLL in a Visual C++ projects. Since i don't have a LIB file and i don't want to use LoadLibrary function i created a DEF file. The contents of the EXPORTS section of the DEF file i toke from DUMPBIN /EXPORTS [the_dll], so it should be ok.
After i created the lib file i included it in my Visual C++ project and the project has compiled successfully. But when i executed it, the application crashed. This application is working when compiled with GCC and the same DLL.
So is the problem somewhere in MinGW or what?
May be i must pass some special parameters to cl.exe or link.exe
Experts please help!
In more details:
So in the header file i have a definition of an abstract class wich has onlu pure virtual methods.
In the DLL i have only one export function which is returning a pointer to an instance of this class or more precisely some class that inherits this abstract class.
The program is something like:
Code:
SomeClass* c = ImportedMethod();
c->someMethod(); // Here the program crashes
It looke strange i know, the problem is that i don't hava the source of the DLL neither i have any more information about it. Only those header:
Code:
class SomeClass
{
public:
virtual void someMethod() = 0;
}
extern "C"
__declspec (dllexport) SomeClass * ImportedMethod();