Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT use DLL from vc6

QT use DLL from vc6

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    youfulan2015
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      youfulan2015
      wrote on last edited by
      #2

      finally i got the reason by myself
      the DLL i called is depend on another
      when i copy the dll to workspace it depend both way works

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved