Results 1 to 4 of 4

Thread: dll loading trouble

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Posts
    4
    Thanks
    1

    Default dll loading trouble

    Here I've got a dll written in C downloaded from the internet. The library is successfully loaded in Qt, functions resolved. But calling these methods causes the app to crash with "Segmentation fault". Besides, I've built a C# project in VS08 and loaded the library. Everything works again.

    Here's the code:
    1.dll library:

    void fdlib_detectfaces(unsigned char *imagedata, int imagewidth, int imageheight, int threshold);

    2.Qt app:

    Qt Code:
    1. ushort graydata[10*10];
    2. QLibrary mylib("\\fdlib.dll");
    3. bool okLoad = mylib.load();
    4. bool loaded = mylib.isLoaded();
    5. typedef void (*FdetectFace)(ushort*,int,int,int);
    6. FdetectFace detectFace = (FdetectFace)mylib.resolve("fdlib_detectfaces");
    7.  
    8. //app crashes here
    9. detectFace(&graydata[0],10,10,0);
    To copy to clipboard, switch view to plain text mode 
    3.C# implementation:

    [DllImport("fdlib.dll")]
    Qt Code:
    1. unsafe public static extern void fdlib_detectfaces(ushort*data,int w,int h,int threshold);
    2.  
    3. public static void TestFace()
    4. {
    5. unsafe
    6. {
    7. UInt16[] image = new ushort[10 * 10];
    8. fixed (ushort* ptr = &image[0])
    9. {
    10. fdlib_detectfaces(ptr, 10, 10, 0);
    11. }
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 23rd February 2011 at 15:04.

Similar Threads

  1. QGLWidget trouble again
    By John82 in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2009, 10:58
  2. QGLWidget trouble
    By John82 in forum Qt Programming
    Replies: 9
    Last Post: 31st July 2009, 01:03
  3. SQL trouble
    By xmeister in forum Newbie
    Replies: 2
    Last Post: 25th March 2009, 11:53
  4. trouble with Qt-4 with kubuntu 8.04
    By impeteperry in forum Installation and Deployment
    Replies: 2
    Last Post: 25th July 2008, 16:21
  5. New to QT..need help guys..sorry for the trouble
    By neomax in forum General Discussion
    Replies: 2
    Last Post: 17th November 2006, 16:20

Tags for this Thread

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.