1

I'm migrating my project from 32 to 64 bits on Windows using mingw64.

Everything is compiling/linking fine, however I have some problems at runtime: the program crashes when calling functions referenced in another DLL, e.g. on a instruction like this:

0x574040   ff 25 e8 66 6a 00   jmpq *0x6a66e8(%rip)   # 0xc1a72e <_ZN12QTableWidget18currentCellChangedEiiii+638>

The example above is with a Qt function, called when starting the application, but I have similar problems with other DLLs.

Strange thing: I have the problem with Qt DLLs in release mode only (which means I use another set of DLLs whose name are ending with 'd').

In debug mode, I have a similar problem but just with one lib. And with this lib, I was able to dynamically load the functions (using QLibrary) so the DLL doesn't seem to be invalid.

I've spent the whole day trying to figure what is wrong, but I have no additional ideas:

  • DLLs and exe files are seen as "file format pei-x86-64" when objdump them.
  • There are supposed to have been compiled with the same compiler (except the additional lib I mentioned which was compiled with MSVC but has only C interface)
  • DLLs files are actually present, next to the exe file (otherwise I would have faced a the meaningful error "X.DLL is mssing from your computer").

If someone has any clue, please let me know!

perror
  • 7,071
  • 16
  • 58
  • 85
Arnaud
  • 536
  • 5
  • 13
  • This post helped me: http://stackoverflow.com/questions/24641898/opencl-crashes-on-call-to-clgetplatformids and so this one as well: http://stackoverflow.com/questions/3573475/how-does-the-import-library-work-details/3573527#3573527 Trying to link against the dll directly fixed the issue. But I'm wondering why using .lib doesn't work, while it worked with 32 bits. Also, for Qt, as everything is automatically generated, I can't really force to link against dll files. So I'm still curious to know why using .lib like I always did doesn't work. – Arnaud Feb 03 '15 at 16:40

1 Answers1

0

OK, there was to problems actually:

  • for the additional lib compiled with MSVC, it is a known issue that it is not possible to link against .lib. As said in comments, it is possible with gcc to link directly against DLL so that fixed the issue for me for this lib.
  • I have problems with other libs in release mode, but that was a totally different issue: the software I'm working has a protection mechanism, activated only in release mode, and that was messing up everything.
Arnaud
  • 536
  • 5
  • 13