// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>

using namespace std;

#include <windows.h>

typedef char *(*whoamifunc)();
typedef int (*opfunc)(int x,int y);

void test(char *dllname)
{
   HINSTANCE mydll = LoadLibrary(dllname);
   whoamifunc fncptr1 = (whoamifunc)GetProcAddress(mydll,"whoami");
   cout << fncptr1() << endl;
   opfunc fncptr2 = (opfunc)GetProcAddress(mydll,"op");
   cout << fncptr2(8,2) << endl;
}

int main()
{
   test("a.dll");
   test("b.dll");
   return 0;
}
