Registered Member
|
Maybe someone here can answer my problem, which is perhaps elementary. I have a native Windows dll, built by me with msvc, that I wish to link to a Qt app built on MinGW with Qt 4.6 Open Source.
Adding the .lib for that dll to the Qt project seems to work OK, but I still get an undefined symbol error from ld. The symbol in question is a plain C function name; nm reports that it is indeed defined as a Target in the .lib and an external in the gcc .obj, with identical spelling. Why is this not working? How to fix it?? Thanks, Tom |
Registered Member
|
You should avoid mixing MSVC and mingw binaries at all costs. It will break in subtle ways, like every time you want to do file I/O.
Having said that, your problem is probably due to an incorrect function declaration: cdecl vs. stdcall vs. fastcall. Try adding one of these decorations to your project (or to the function import declaration) and re-compile. Good luck in getting it to work, but in the end it will probably be easier to just recompile everything with one compiler (that's a lesson I learned the hard way too...)
This is not a signature...
|
Registered Member
|
Thanks, but I prefer to beat my head against the wall. At least until I solve the following problem: It doesn't work with MS tools either!
That is, I built an app with msvc that tries to call this dll, and MS link also gives me the undefined symbol error, though objectdump agrees that the symbol is in the .lib. Evidently there is something wrong with how I'm building the dll. I adapted it from a Windows SDK sample that only exports PRIVATE symbols. --Tom |
Registered Member
|
PS I'm not trying to do a static link here. That would indeed be mixing apples & oranges. But MinGW programs link to Windows dlls all the time without problem.
|
Registered Member
|
Have you tried fiddling with the linkage parameters (cdecl etc.)? Or maybe you're just missing an 'extern "C" {...}' around your function declarations?
This is not a signature...
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Sogou [Bot]