Results 1 to 9 of 9

Thread: Using Qlibrary on a function that uses arguments

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using Qlibrary on a function that uses arguments

    Is the application multithreaded?

  2. #2
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    80
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Qlibrary on a function that uses arguments

    Yes, the function in which the DLL is accessed runs within a thread.
    But I don't understand how this can affect how filling a simple QString can behave differently before and after the DLL function is called.
    I have attached a demo project, including the DLL, in a previous post, that can be used to reproduce the strange behavior I am observing, so that you can have a look if you want.

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

    Default Re: Using Qlibrary on a function that uses arguments

    Maybe the function is not reentrant?

  4. #4
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    80
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Qlibrary on a function that uses arguments

    I've got the answer from the Trolltech support.

    I negliged the windows calling convention (cf article at http://www.unixwiz.net/techtips/win32-callconv.html) with the consequence of corrupts memory all over the place.

    Finally I had to change my typedef from:

    Qt Code:
    1. typedef short int (*GetInfo)(unsigned char,unsigned char,unsigned char *,unsigned char *,unsigned char *,unsigned char *);
    To copy to clipboard, switch view to plain text mode 
    into:

    Qt Code:
    1. typedef short int (__stdcall *GetInfo)(unsigned char,unsigned char,unsigned char *,unsigned char *,unsigned char *,unsigned char *);
    To copy to clipboard, switch view to plain text mode 

    That solved everything.

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
  •  
Qt is a trademark of The Qt Company.