xenogenesi::blog
memento
3d adt android apache2 app apt aria2 build bullet cflags chromium codeigniter debian demoscene dependencies dpkg driver emulator freeglut gcc gfx git glut htaccess javascript json kernel linux make metalink minimal mysql opengl php python raspbian realtime rpi specs template toolchain update-alternatives video wifi wordpress

mingw-w64 generate and use a dll .def file and implib

Dom, 16 Lug 2017 12:42:37 +0200

download the sources and build expdef.exe

  i686-w64-mingw32-g++-win32 -static -m32 -Wall -O2 -o expdef.exe expdef.cpp

generate the .def and the libsomething.dll.a implib

  wine ./expdef.exe -p -o something.dll >something.def
  i686-w64-mingw32-dlltool --no-leading-underscore -d something.def -D something.dll -l libsomething.dll.a

if something.dll use stdcall convention the sources need to prefix the prototype declarations with [[gnu::stdcal]]

  [[gnu::stdcall]] void *SomeFunctionInSomething(void);

build and link the executable

  i686-w64-mingw32-g++-win32 -Wall -O2 -I./include -o someprogram.exe someprogram.cpp -L. -lsomething

That’s it.