Dll的源码
#include <stdio.h>
void test()
{
printf("Hello world!\n");
}
int sum(int a,int b)
{
return (a + b);
}
Dll-def的源码
LIBRARY
EXPORTS
test
sum
调用Dll的主程序源码
#include <Windows.h>
#include <stdio.h>
typedef int(*Sum)(int,int);
void main() {
HMODULE HDLL = LoadLibrary("Project1.dll");
FARPROC test = GetProcAddress(HDLL, "test");
test();
Sum sum = (Sum)GetProcAddress(HDLL, "sum");
printf("%d\n",sum(3,5));
system("pause");
FreeLibrary(HDLL);
}