6

I have a library (lib file + .h header file). I like to turn it into a DLL so I can easiliy use it in VB6. Is there a convenient way to do this?

Robbert Dam
  • 4,027
  • 10
  • 39
  • 58
  • possible duplicate of [Convert static windows library to dll](http://stackoverflow.com/questions/845183/convert-static-windows-library-to-dll) –  Sep 25 '12 at 20:39
  • 1
    What does the lib contain? Does it only contain import descriptors for some external DLL or does it contain actual code? – 0xC0000022L Sep 26 '12 at 14:46

1 Answers1

2

Simply include the header file an a .def file in a new dll project and link it with the static lib.

The details of how to export symbols with a def file are here http://msdn.microsoft.com/en-us/library/d91k01sh(VS.80).aspx

iain
  • 10,798
  • 3
  • 37
  • 41
  • On windows he may have to modify the header file to inform VC what symbols have to be exported from the DLL. so he may add some __declspec xxx around the functions in the header file. – Friedrich Nov 27 '12 at 16:13
  • 1
    You can use a .def file to force the export of functions without requiring the __declspec in the headers. I recommend this because the poster does not require the header to both import and export. – iain Jan 14 '13 at 09:20
  • Remember the def file contains the mangled names, so for C++ especially this will be a pain to maintain. – rubenvb Aug 10 '13 at 13:46
  • You are right about C++ name mangling, but maintaining the def file will be easy compared to the VB6 code calling the functions :-) – iain Aug 13 '13 at 09:30