Home > Mobile >  C + +/qt call dl error
C + +/qt call dl error

Time:11-16

//# include "widget. H" 

#include

#include
#include
#include
#include

#include
Using STD: : string;

#include
#include

//typedef STD: : string (* shibei) (string, string, string, string, string);//define a function pointer


//typedef QStringList FUN1 (*) (QString dll_Name);


Typedef string (CALLBACK * p_shibie) (string model_file, string trained_file, string mean_file,
String label_file, string image_file);

//typedef bool (CALLBACK * SetKeyBoardHook) (HWND);

HINSTANCE hDLL;//Handle to the DLL
P_shibie shibiep;//Function pointer
String STR.
//string caffe_exe_path="classification. Exe";
//path +
String path="D:/Qfile/build - testDll - Desktop_Qt_5_14_2_MinGW_32_bit - Release/Release/";
String caffe_path=path + "Myclassification. DLL";
String deploy_path=path + "d.p";
String model_path=path + "r.m;"
String mean_path=path + t.b "";
String words_path=path + "w.t";
String image_path=path + "1. PNG";


Void test2 ()
{
//D:/Qfile testDll/
QLibrary mylib (" Myclassification. DLL ");
If (mylib. The load ())
{
QDebug () & lt; <"Dllhook load success";
Shibiep=(p_shibie) mylib. Resolve (" shibie ");
If (shibiep)
{
QDebug () & lt; <"SetKeyBoardHook load success";
STR=shibiep (deploy_path model_path, mean_path, words_path, image_path);
QDebug () & lt; <" Result: "& lt;
//a Boolean flag=open ((HWND) this - & gt; WinId ());
}
}

}


Void test ()
{
Myclassification hDLL=LoadLibrary (" ");//"dllhook" for the DLL file name
If (hDLL!=NULL)
{
QDebug () & lt; <"Dllhook load success";
//the dynamic library "SetKeyBoardHook" so as to realize the function name
Shibiep=(p_shibie) GetProcAddress call (hDLL, "shibie");
If (shibiep!=NULL)
{
QDebug () & lt; <"SetKeyBoardHook Success";
STR=(shibiep) (deploy_path model_path, mean_path, words_path, image_path);
QDebug () & lt; <" Result: "& lt; }
The else
{
//FreeLibrary (hDLL);
QDebug () & lt; <" SetKeyBoardHook Fail ";
return;
}
}
}



Int main (int arg c, char * argv [])
{
//QApplication a (arg c, argv);

Test2 ();

//test ();

//Widget w;
//baron how ();
//return a.e xec ();

}



Has been an error, path into absolute and relative no,
Error:
 dllhook load success 
SetKeyBoardHook load success
* * * Check failure stack trace: * * *
Abnormal end 21:45:57: applications,

Consult everybody bosses how to solve the problem?
DLL as caffe executive function

Pro file for:
 QT +=core GUI 

GreaterThan (QT_MAJOR_VERSION, 4) : QT +=widgets

The CONFIG + c + + 11=

DEFINES -=UNICODE

# The following define top service your compiler emit warnings if you use The
# any Qt feature that has had marked deprecated (the exact warnings
# depend on your compiler). Both Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES +=QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile the if it USES deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select the to disable deprecated APIs only up to a certain version of Qt.
# # DEFINES +=QT_DISABLE_DEPRECATED_BEFORE=0 x060000 disables all the APIs deprecated before Qt 6.0.0

SOURCES +=\
The main. CPP \
Widget. The CPP

HEADERS +=\
Widget. H

FORMS +=\
The widget. The UI

# the Default rules for deployment.
QNX: target path=/TMP/$${target}/bin
The else: Unix:! Android: target path=/opt/$${target}/bin
! IsEmpty (target path) : INSTALLS +=target

# LIBS +=- l. - lExcelApI

# LIBS +=- l. C:/Users/Admin/Downloads/QTDLL QTDLL/libcaffe/\
# - Myclassification \
# - gflags

# LIBS +=- l. - lMyclassification

INCLUDEPATH +=D:/Desktop/OpenCV/64/include
LIBS +=D:/Desktop/OpenCV/64/mingw/lib/libopencv_ *. A


Win32: CONFIG (release, the debug | release) : LIBS +=L $$PWD/libcaffe/- lMyclassification
The else: win32: CONFIG (debug, the debug | release) : LIBS +=L $$PWD/libcaffe/- lMyclassificationd

INCLUDEPATH +=$$PWD/libcaffe
DEPENDPATH +=$$PWD/libcaffe


LIBS +=D:/Qfile/build - testDll - Desktop_Qt_5_14_2_MinGW_32_bit - Release/Release/gflags DLL
LIBS +=D:/Qfile/build - testDll - Desktop_Qt_5_14_2_MinGW_32_bit - Release/Release/hdf5 DLL
LIBS +=D:/Qfile/build - testDll - Desktop_Qt_5_14_2_MinGW_32_bit - Release/Release/hdf5_cpp DLL
LIBS +=D:/Qfile/build - testDll - Desktop_Qt_5_14_2_MinGW_32_bit - Release/Release/hdf5_f90cstub DLL
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • Qt
  • Related