I have MyDll.dll and I want access its function Myfunction which is in the form:
Void pascal Myfunction(BOOL);
Here is my code:
#include "stdafx.h"
#include "iostream"
#include "windows.h"
using namespace std;
void calldll();
extern "C" __declspec(dllexport) void Myfunction(BOOL);
void calldll()
{
HINSTANCE hDll;
DWORD dwErrorCode=0;
LoadMe=LoadLibrary(_T("MyDll.dll"));
if(hDll!=NULL)
{
cout<<"\n DLL loaded successfully \n";
}
else
cout<<"\n Unable to load DLL \n";
Myfunction sp1=(Myfunction)GetProcAddress(hDll,"Myfunction");
if(sp1!=NULL)
{
cout<<"\n Process loaded successfully \n";
}
else
{
cout<<"\n Unable to load Process \n";
}
FreeLibrary(hDll);
}
It is giving error as:
1.syntax error : missing ';' before identifier 'sp1'
2.'sp1' : undeclared identifier
3.syntax error : missing ';' before identifier 'GetProcAddress'
Which I don't understand. Can any help me in this regard.