_declspec(dllexport) int __cdecl add (int a,int b)
{
return a+b;
}
_declspec(dllexport) int _stdcall sub (int a,int b)
{
return a-b;
}
#include <stdio.h>
#include <windows.h>
int main (void)
{
typedef int(_cdecl *Add)(int a,int b);
typedef int(_stdcall *Sub)(int a,int b);
HINSTANCE hInst=LoadLibrary(TEXT("dll3.dll"));
if (hInst)
{
Add add=(Add)GetProcAddress(hInst,"add");
Sub sub=(Sub)GetProcAddress(hInst,"sub");
Sub subID=(Sub)GetProcAddress(hInst,MAKEINTRESOURCE(2));
printf("%d\n",add(5,3));
printf("%d\n",sub(5,3));
printf("%d\n",subID(5,3));
}
return 0;
}