linking dilemma (undefined reference) between MinGW and MSVC. MinGW fails MSVC works

后端 未结 2 346
后悔当初
后悔当初 2020-12-21 13:47

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

2条回答
  •  遥遥无期
    2020-12-21 14:04

    As you have already discovered yourself - name mangling may be different across compilers. To solve your problem follow the instructions:

    1. Download and install (can build from source) gendef utility:

      • If you have usual MinGW (targeting 32-bit), then obtain it here;
      • If you have MinGW-w64 (targeting 64-bit), then obtain it here.
    2. Run gendef wtuxws32.dll (will generate wtuxws32.def);

    3. Run dlltool -D wtuxws32.dll -d wtuxws32.def -l libwtuxws32.a (will generate libwtuxws32.a);

    4. Put libwtuxws32.a to D:/dev/tuxedo/lib;

    5. Now link against it.

提交回复
热议问题