Results 1 to 2 of 2

Thread: qt call dll created by vc6

  1. #1
    Join Date
    Jul 2015
    Posts
    5
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Cool qt call dll created by vc6

    qt 5.4+mingw+windows7 is my environment
    I have the hole VC6 project ,i export a dll from vc6 the header like this:
    #ifndef DLL_API
    #define DLL_API extern "C" __declspec(dllimport)
    #endif
    #define WIN_API __stdcall
    DLL_API WORD WINAPI dsoHTSearchDevice(short* pDevInfo);

    DLL_API WORD WINAPI dsoHTDeviceConnect(WORD nDeviceIndex);
    DLL_API WORD WINAPI dsoHTDeviceConnecttest(WORD nDeviceIndex) //this method do nothing but only to return a number to test ifthe dll works
    .....................................
    but when i try to use it in my qt ,it didnot work,I try in two way
    1
    LIBS +=-LD:/From_Peng/HTHardDll/HTHardDll -lHTHardDll
    INCLUDEPATH +=D:/From_Peng/HTHardDll
    i include the header file and call function
    dsoHTDeviceConnecttest(0)
    "DLL_API WORD WINAPI dsoHTDeviceConnecttest(WORD nDeviceIndex)
    {
    return 2;
    }"which should return 2

    but my debug exe go crash when call this fun
    2
    QLibrary myLib("D:/From_Peng/HTHardDll/HTHardDll/HTHardDll");

    if(myLib.load())

    {
    qDebug()<<"load lib success";
    }
    else
    {
    qDebug()<<"load lib failed";

    }
    in this method it all ways output load lib failed
    is there any guy know the reason?

  2. #2
    Join Date
    Jul 2015
    Posts
    5
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qt call dll created by vc6

    I have came out with the reason;
    the dll i add to my pro is depend on another
    when i copy it to directory where the exe exist in
    everything goes well

Similar Threads

  1. Replies: 4
    Last Post: 8th April 2013, 04:19
  2. Replies: 6
    Last Post: 3rd December 2012, 07:26
  3. Database not being created
    By Splatify in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2011, 00:31
  4. Check has created with new
    By wirasto in forum Qt Programming
    Replies: 5
    Last Post: 16th March 2010, 16:02
  5. Replies: 6
    Last Post: 3rd September 2008, 14:27

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.