pbdll.cpp:
#include <windows.h>
#include <stdio.h>
extern "C" __declspec(dllexport) int WINAPI out_num(int x)
{
int y;
char msg[30];
y=x;
sprintf(msg, "计算结果:%o!",y);
::MessageBox(NULL,msg,"信息",MB_OK);
return 0;
}
pbdll.def:
LIBRARY "pbdll"
EXPORTS
#include <windows.h>
#include <stdio.h>
extern "C" __declspec(dllexport) int WINAPI out_num(int x)
{
int y;
char msg[30];
y=x;
sprintf(msg, "计算结果:%o!",y);
::MessageBox(NULL,msg,"信息",MB_OK);
return 0;
}
pbdll.def:
LIBRARY "pbdll"
EXPORTS
out_num @1
PB://上面的与下面的方法并不是同一个,但编译与调用大致方法就是这样,网上很多都没有写def文件,调用不成功(不知道为什么别人可以)
FUNCTION int add(int x,int y)LIBRARY "MyDLL.dll" //ALIAS FOR "add"