I\'m trying to port an old C .dll library originally done with MSVC that uses BEA Tuxedo library to use MinGW.
I have encountered a situation where MSVC compiles an
As you have already discovered yourself - name mangling may be different across compilers. To solve your problem follow the instructions:
Download and install (can build from source) gendef
utility:
Run gendef wtuxws32.dll
(will generate wtuxws32.def
);
Run dlltool -D wtuxws32.dll -d wtuxws32.def -l libwtuxws32.a
(will generate libwtuxws32.a
);
Put libwtuxws32.a
to D:/dev/tuxedo/lib
;
Now link against it.
Change the declaration of tpsetunsol()
in the atmi.h
header from:
extern void (_TMDLLENTRY * _TMDLLENTRY tpsetunsol _((void (_TMDLLENTRY *)(char _TM_FAR *, long, long)))) _((char _TM_FAR *, long, long));
to:
extern void (_TMDLLENTRY * (_TMDLLENTRY tpsetunsol) _((void (_TMDLLENTRY *)(char _TM_FAR *, long, long)))) _((char _TM_FAR *, long, long));
// ^ ^
so the function will be properly declared to be a stdcall
function as it is in the library (as indicated by the @4
suffix on the name in the library).