Hello everybody,
I am trying to create a DLL by using a .DEF file and targeting the
MinGW gcc-compiler. In my CMakeLists.txt I have this:
add_library(MyDll SHARED
MyDll.cpp
dllmain.cpp
stdafx.cpp
MyDll.def).
I have the following sources:
MyDll.def:
LIBRARY libMyDll
EXPORTS testfunc
stdafx.cpp:
#include "stdafx.h"
stdafx.h:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
dllmain.cpp:
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
and finally
MyDll.cpp:
#include "stdafx.h"
__declspec(dllexport) int __stdcall testfunc(int x )
{
return 1;
}
If I do a regular cmake to create Visual Studio files, everything
compiles and links just fine (within VS Express 2010). But if I use
the CMAKE GUI and explicitly target MinGW, and then use make in the
cmd-prompt then I get the following error:
Creating library file: libMyDll.dll.a
Cannot export testfunc: symbol not defined
Any idea of what I am doing wrong here? I would really appreciate some help.
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake