Contents |
Static libraries (.lib) can be linked into a DLL without any issues.
DLL's require an import library (also .lib) to use (or possibly some other import specification).
Creating a DLL is done in these steps:
You can inspect the exported symbols using dumpbin /all FILE. To use Visual Studio command line tools, execute:
"%vcinstalldir%\bin\vcvars32.bat"
GCC exports all public symbols to a shared library automatically. According to MSDN, Visual Studio or link.exe cannot automatically export symbols, you have to specify them manually, either by prefixing all methods with __declspec(dllexport) or by manually generating a .def file.
As of 2010-04-13, I have not been able to find any tool to do this automatically.
On Mac OS X, libraries have the following naming standard:
libstaticlibrary.a libsharedlibrary.dylib
Loading shared libraries is case-insensitive.
If .dylibs cannot be located, use:
DYLD_LIBRARY_PATH=/path/to/lib/ ./executable
g++ -dynamiclib -all_load libinput1.a libinput2.a -o liboutput.dylib
-all_load is a ld inherited by g++ which forces ld to include all members of the static archive libraries in the output shared library.
Checking the output:
nm liboutput.dylib