How to make import library from DLL(for Visual C++ or MinGW)

Just a note for myself.

How to refine VC++ import library LIB files for DLLs created from Lazarus or MinGW:
  • dumpbin /exports file.dll(dumpbin is included in VC++)
  • Use a text editor to write a def file(e.g. file.def) like the content below:
    EXPORTS
    functiona
    functionb
    functionc
    ……
  • lib /def:file.def to create lib file
  • use the lib file in compilation of application to make the application aware of DLL entry points

To use DLLs from Visual C++ to MinGW, the def files from dumpbin can be compiled into .a files(library files for GCC) with DLLTOOL in MinGW:
  • dlltool -U -d file.def -l file.a
Compatibility note: for compatibility with other compilers and languages(e.g. C++ vs. Pascal), always use stdcall for calling convention and extern “C” in C++ side.

PostgreSQL vs. SQLite: read & write in multithreaded environment

The start was humble. I needed to cache some data, and I thought just push them to database table and give index, and the rest will be datab...

Popular in Code{nested}