- #include <stdio.h>
- #include <windows.h>
- typedef int (*lpAddFunc)(int,int);
- int main()
- {
- lpAddFunc sum;
- HINSTANCE hDLL = ::LoadLibrary("MyDll.dll");
- if(hDLL)
- {
- sum = (lpAddFunc)::GetProcAddress(hDLL,"sum");
- if(sum)
- {
- int result = sum(1,2);
- printf("%d",result);
- }
- ::FreeLibrary(hDLL);
- }
- return 0;
- }