Я хочу использовать pjsipDll.dll в C++-коде. Я получил эту dll с одного из сайтов, я знаю, как создать код для получения файла dll. Поэтому я сделал это, и теперь у меня есть файл pjsipDll.dll со мной. Я хочу использовать определенные функции в DLL в своем коде (C++)Использование dll в коде C++
Я пробовал следующий код. < < я не сделал/добавил DLL или .h файла в проект, есть только следующий CPP файл >>
#include <iostream>
using namespace std;
int CallMyDLL(void)
{
/* get handle to dll */
HINSTANCE hGetProcIDDLL = LoadLibrary("G:\\July\\9.0\\pjsipdll\\Lib\\pjsipDll.dll");
/* get pointer to the function in the dll*/
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE (hGetProcIDDLL),"dll_makeCall");
/*
Define the Function in the DLL for reuse. This is just prototyping the dll's function.
A mock of it. Use "stdcall" for maximum compatibility.
*/
typedef int (__stdcall * pICFUNC)(int, char *);
pICFUNC MyFunction;
MyFunction = pICFUNC(lpfnGetProcessID);
/* The actual call to the function contained in the dll */
int intMyReturnVal = MyFunction(5,"hello");
/* Release the Dll */
FreeLibrary(hGetProcIDDLL);
/* The return val from the dll */
returnintMyReturnVal;
}
void main()
{
cout<<"Hello World";
CallMyDLL();
getchar();
}
Я узнал этот путь от какого-либо сайта, чтобы использовать функции из DLL ,
Проблема заключается в том, я получаю сообщение об ошибке:
error C2065: 'HINSTANCE' : undeclared identifier g:\july\9.0\pjproject-0.9.0\myproject\importerprojet\importerprojet\mycpp.cpp 9 importerProjet
Может кто-нибудь помочь мне с этим. Или, по крайней мере, укажите мне сообщение, если этот запрос уже рассмотрен.
Спасибо за вашу помощь, Vinu.
Я думаю, вы должны включать '' –
Mohammad