dll_test.dll :
extern "C" __declspec(dllexport)void MultiplyBy(int,int);
int MulitplyBy(int value,int multiplier)
{
return value*multiplier;
}
program testujący:
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
HMODULE hModule = LoadLibrary("C:\\dll_test.dll");
if (hModule == NULL)
MessageBoxW(0,L"Error with getting handle to module",L"Error!",0);
int hMultiplyBy = (int)GetProcAddress (hModule, "MultiplyBy");
if (hMultiplyBy == NULL)
MessageBoxW(0,L"Error with getting handle to the function",L"Error!",0);
//cout<<MultiplyBy(5,5);
FreeLibrary (hModule);
cout<<endl;
system("PAUSE");
return 0;
}
Nie rozumiem dlaczego program nie może uchwycić funkcji MultiplyBy...