for some reason I do not want to use the C API with MinGW 4.9, so I had to make myself an import library for fmod (L). dll, I hope it will be useful.

test example (without error checking):[code:1tviu5j5]#include <stdio.h>

include "fmod.hpp"

int main()
FMOD::System *system = NULL;

unsigned int version;
printf(&quot;FMOD lib version %08x founded\n&quot;, version);

system-&gt;init(512, FMOD_INIT_NORMAL, 0);


return 0;

compiles and see several "undefined reference…". add key "[i:1tviu5j5]-Wl, – no-demangle[/i:1tviu5j5]" for linker to see the mangled names of functions:[code:1tviu5j5]g++ -o main.exe main.cpp -Wl,–no-demangle
...undefined reference to __ZN4FMOD6System10getVersionEPj@8'
...undefined reference to
...undefined reference to __ZN4FMOD6System7releaseEv@4'
...undefined reference to

start fixing it.[list=1:1tviu5j5][:1tviu5j5]first get the export table and ordinals of fmod.dll, it needs to use [i:1tviu5j5]dumpbin[/i:1tviu5j5] utility from Visual Studio:[code:1tviu5j5]dumpbin /exports fmod.dll > fmod.exports.txt[/code:1tviu5j5]
[*:1tviu5j5]look at the mangled function: __ZN4[b:1tviu5j5][color=#008000:1tviu5j5]FMOD[/color:1tviu5j5][/b:1tviu5j5]6[b:1tviu5j5][color=#008000:1tviu5j5]System[/color:1tviu5j5][/b:1tviu5j5]10[b:1tviu5j5][color=#008000:1tviu5j5]getVersion[/color:1tviu5j5][/b:1tviu5j5]EPj@8, remember the last value [b:1tviu5j5]getVersion[/b:1tviu5j5]

:1tviu5j5]open [i:1tviu5j5]fmod.exports.txt[/i:1tviu5j5] and find this value, get something like

[b:1tviu5j5][color=#0000FF:1tviu5j5]185[/color:1tviu5j5][/b:1tviu5j5] B8 000B8AD0 ?[b:1tviu5j5][color=#008000:1tviu5j5]getVersion[/color:1tviu5j5][/b:1tviu5j5]@[b:1tviu5j5][color=#008000:1tviu5j5]System[/color:1tviu5j5][/b:1tviu5j5]@[b:1tviu5j5][color=#008000:1tviu5j5]FMOD[/color:1tviu5j5]@@QAG?AW4FMOD_RESULT@@PAI@Z[/b:1tviu5j5]

we need only the first number

:1tviu5j5]repeat this for all "undefined reference"

:1tviu5j5]create a .def file (fmod4gcc.def, for example):[code:1tviu5j5]LIBRARY "fmod.dll"
_ZN4FMOD6System10getVersionEPj@8 @185 NONAME
_ZN4FMOD6System4initEijPv@16 @189 NONAME
_ZN4FMOD6System7releaseEv@4 @213 NONAME
FMOD_System_Create@4 @989 NONAME[/code:1tviu5j5]
[list:1tviu5j5][*:1tviu5j5][i:1tviu5j5]_ZN4FMOD6System10getVersionEPj@8[/i:1tviu5j5] — this is a mangled name for GCC[/*:m:1tviu5j5]
[*:1tviu5j5][i:1tviu5j5]@185[/i:1tviu5j5] — ordinal founded in fmod.exports.txt[/*:m:1tviu5j5]
[*:1tviu5j5][i:1tviu5j5]NONAME[/i:1tviu5j5] — no names, ordinal only[/*:m:1tviu5j5][/list:u:1tviu5j5]
[*:1tviu5j5]now can create an import library:[code:1tviu5j5]dlltool -d fmod4gcc.def -l libfmod4gcc.a [/code:1tviu5j5]
and add the resulting library:[code:1tviu5j5]g++ -o main.exe main.cpp -Wl,–no-demangle -L. -lfmod4gcc[/code:1tviu5j5][/*:m:1tviu5j5][/list:o:1tviu5j5]

FMOD lib version 00010400 founded[/code:1tviu5j5]

I do not know whether it is possible to automate this process, manually it takes a lot of time :(
but this method works, I successfully compiled all the examples shipped with the version 1.04.00

  • You must to post comments

I’m amazed that worked, its certainly not the recommended method :)
The C++ ABI is usually incompatible between all different compilers, thats why for dll compatibility between compilers we recommend simply using the C functionality.
usually you just use dlltool on the dll , and if it needs a def file, its just a simple list of the C symbols with no mangling.
You are restricted to the C interface though as mentioned.

  • You must to post comments

as I recall, a different ABI does not allow to link the program to the level of binary code. FMOD has no static library, only the external DLL, and the only problem is different calling conventions (gcc vs msvc).

different ABI can not be corrected, but the calling convention can "workaround" using ordinals.

I also can not recommend this method. changing / updating the library will need a lot of manual work, so this method can be considered only as an experiment.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.