Brett,
I generated libfmod.a for the low level using dlltool and the .def you provided, and it seems to work! I did, however, hit a snag where it seems like the preprocessor was picking up a wrong set of #defines for some calling conventions in fmod_common.h.
...
In file included from c:\mingw\include\fmod\fmod.h:14:0,
from test.cpp:1:
c:\mingw\include\fmod\fmod_common.h:1115:33: error: expected ')' before '*' token
typedef FMOD_RESULT (F_CALLBACK *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void *commanddata2, void *userdata);
^
c:\mingw\include\fmod\fmod_common.h:1117:33: error: expected ')' before '*' token
typedef FMOD_RESULT (F_CALLBACK *FMOD_CHANNELCONTROL_CALLBACK) (FMOD_CHANNELCONTROL *channel, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2);
...
Looking at the preprocessed source, I see the following:
...
typedef FMOD_RESULT (_stdcall *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void *commanddata2, void *userdata);
typedef FMOD_RESULT (_stdcall *FMOD_CHANNELCONTROL_CALLBACK) (FMOD_CHANNELCONTROL *channel, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2);
...
Meanwhile, fmod_common.h contains:
/*
Compiler specific settings.
*/
#if defined(__CYGWIN32__)
#define F_CDECL __cdecl
#define F_STDCALL __stdcall
#define F_DECLSPEC __declspec
#define F_DLLEXPORT ( dllexport )
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
#define F_CDECL _cdecl
#define F_STDCALL _stdcall
#define F_DECLSPEC __declspec
#define F_DLLEXPORT ( dllexport )
#elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__)
#define F_CDECL
#define F_STDCALL
#define F_DECLSPEC
#define F_DLLEXPORT __attribute__ ((visibility("default")))
#else
#define F_CDECL
#define F_STDCALL
#define F_DECLSPEC
#define F_DLLEXPORT
#endif
Looks like MinGW + gcc is falling into the WIN32 set of defines. I ended up getting around this for the time being by adding #define CYGWIN32 just prior to including the fmod headers, and now my test program compiles, links, and runs just fine. The preprocessed output looks like so:
...
typedef FMOD_RESULT (__attribute__((__stdcall__)) *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void *commanddata2, void *userdata);
typedef FMOD_RESULT (__attribute__((__stdcall__)) *FMOD_CHANNELCONTROL_CALLBACK) (FMOD_CHANNELCONTROL *channel, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2);
...
As long as I can do something similar to FMOD Studio, even if it’s just the C API, then I should be able to get things up and running!
-Dale Kim