0

Can someone please guide me on how to convert a .lib static library into a .dll file using MinGW on Windows.

Thanks.

Josh Durham
  • 1,632
  • 1
  • 17
  • 28
sbunny
  • 433
  • 6
  • 25
  • You cannot convert that, but you might create a dll using the static .lib and re-export everything. – wimh Jul 23 '15 at 17:57
  • Using cygwin, you can do gcc -shared -o library.so -lstatic_library. – Jens Munk Jul 23 '15 at 18:01
  • But if the static library is compiled using a different compiler, you are most likely screwed – Jens Munk Jul 23 '15 at 18:02
  • @Wimmel > you might create a dll using the static .lib and re-export everything Can you please elaborate this a bit. I have successfully converted a static library ".a" to a shared object ".so" on Linux. Now I want to convert the ".lib" file to a ".dll" for Windows using MinGW Actually the libraries which I am using are available as static libraries ".a" for Linux and ".lib" for windows. I am just trying to generate shared libraies from these static libs. – sbunny Jul 23 '15 at 18:19
  • I tested it with [IJG-JPEG library](http://www.ijg.org/) and I needed a [DllMain](https://msdn.microsoft.com/en-us/library/aa370448%28v=vs.85%29.aspx) simply returning TRUE. `gcc -Wl,-export-all-symbols -Wl,-enable-auto-import -Wl,-no-undefined -Wl,--enable-runtime-pseudo-reloc dllmain.c -Wl,-whole-archive jpeg-9a\libjpeg.a -Wl,-no-whole-archive -shared -o jpeg9a.dll` – 4566976 Jul 26 '15 at 12:34

1 Answers1

0

Very simple. Rebuild the library as a static dynamic library.

If you don't have the source code, contact the vendor for a static dynamic version of the library.

Thomas Matthews
  • 56,849
  • 17
  • 98
  • 154