Shared Libraries (dlls) using MinGW

So I’ve been looking around for people who have built shared libraries on windows and have run in to a bit of a stumbling block. I’m able to compile without the BUILD_SHARED_LIBS flag but if I put turn the flag on as follows:

cmake -G “MinGW Makefiles” -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON …/llvm-2.7

Then call:

mingw32-make

I get:

Linking CXX shared library …..\bin\libLLVMSystem.dll
Info: resolving vtable for std::basic_stringbuf<char, std::char_traits, std::allocator > by linking to __imp___ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving std::basic_string<char, std::char_traits, std::allocator >::_Rep::_S_empty_rep_storage by linking to __imp___ZNSs4_Rep20_S_empty_rep_storageE (auto-import)
Info: resolving vtable for std::basic_streambuf<char, std::char_traits > by linking to __imp___ZTVSt15basic_streambufIcSt11char_traitsIcEE (auto-import)
Info: resolving vtable for std::basic_ios<char, std::char_traits > by linking to __imp___ZTVSt9basic_iosIcSt11char_traitsIcEE (auto-import)
Info: resolving VTT for std::basic_stringstream<char, std::char_traits, std::allocator > by linking to __imp___ZTTSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for std::basic_stringstream<char, std::char_traits, std::allocator > by linking to __imp___ZTVSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for __cxxabiv1::__class_type_info by linking to __imp___ZTVN10__cxxabiv117__class_type_infoE (auto-import)
Creating library file: …\libLLVMSystem.dll.a
c:/mingw/bin/…/lib/gcc/mingw32/4.5.0/…/…/…/…/mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
CMakeFiles/LLVMSystem.dir/DynamicLibrary.cpp.obj:DynamicLibrary.cpp:(.text+0x40a): undefined reference to _imp__EnumerateLoadedModules@12' CMakeFiles/LLVMSystem.dir/Process.cpp.obj:Process.cpp:(.text+0xbe): undefined reference to GetProcessMemoryInfo@12’
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x1d9): undefined reference to _imp__SymSetOptions@4' CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x1f9): undefined reference to _imp__SymInitialize@12’
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x221): undefined reference to _imp__SymGetModuleBase@8' CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x22b): undefined reference to _imp__SymFunctionTableAccess@8’
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x26c): undefined reference to _imp__StackWalk@36' CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x2de): undefined reference to _imp__SymGetModuleBase@8’
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x353): undefined reference to _imp__SymGetSymFromAddr@16' CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x3b9): undefined reference to _imp__SymGetLineFromAddr@16’
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/libLLVMSystem.dll] Error 1
mingw32-make[1]: *** [lib/System/CMakeFiles/LLVMSystem.dir/all] Error 2
mingw32-make: *** [all] Error 2

Any help would be greatly appreciated.
btw: my MinGW gcc is version 4.5.0.

Thanks,
Kevin

Kevin Browder <kbrowder@gmail.com> writes:

So I've been looking around for people who have built shared libraries on
windows and have run in to a bit of a stumbling block. I'm able to compile
without the BUILD_SHARED_LIBS flag but if I put turn the flag on as follows:

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS:BOOL=ON ../llvm-2.7

Shared libraries are not supported on Windows. The configure&make build
has an option for building a single DLL containing all LLVM.

[snip]