Results 1 to 6 of 6

Thread: Name mangling dll function loading

  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Name mangling dll function loading

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Name mangling dll function loading

    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?

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Name mangling dll function loading

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Name mangling dll function loading

    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).

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Name mangling dll function loading

    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

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Name mangling dll function loading

    Quote Originally Posted by TheKedge View Post
    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).

  7. The following user says thank you to wysota for this useful post:

    TheKedge (30th July 2008)

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.