PDA

View Full Version : Name mangling dll function loading



TheKedge
28th July 2008, 16:47
Hello All,

I've got a third party DLL which I'd like to use. The dependancy viewer shows names like
_FuncName@04. These names are not un-decorated by the dep-viewer.
(names of the form ?FuncName@@FYI@@Z are undecorated properly)

I can use QLibrary to resolve("_FuncName@04") - it works - but I'm not sure if it's safe or if the next version of the DLL will have different decorations.
I know the function is called "FuncName" but QLibrary doesn't resolve that.

Can I get an undecorated name somehow? Has the maker of the DLL done something awkward?

thanks
K

wysota
28th July 2008, 17:48
Do you have to load the symbols during run-time? Can't you link against the library in a more regular fashion? Do you have a header file matching the dll?

TheKedge
29th July 2008, 13:04
Because I can't be sure that the DLL is on the target system. (The DLL controls some hardware which may or may not be installed on the target system). So, there's no point in me just using installing the DLL as if the hardware was there.

If the DLL is present it I know I can use it. If it's absent, I'll be doing something else.
I thought that using if(QLibrary.load()) would be perfect for the job.

K

wysota
29th July 2008, 13:20
Yes, QLibrary is the way to go. If the dll is compiled with the same compiler family as your application, demangling should work fine. Otherwise it will probably not work (for instance when using a MinGW compiled DLL with MSVC compiled application).

TheKedge
29th July 2008, 13:28
Yes, demangling is not working. Is there any clever way I can proceed?

Is it safe to use an mangled name - or do the mangled names change with DLL builds?

thanks,
K

wysota
29th July 2008, 19:40
Yes, demangling is not working. Is there any clever way I can proceed?
Make sure the dll is compiled properly. If you don't have influence on it, you have to live with it.


Is it safe to use an mangled name - or do the mangled names change with DLL builds?

Names can change if a different compiler is used (even a different version).