stdcall 标准winNTdll 编写 与 调用

来源:互联网 发布:软件开发企业 深圳 编辑:程序博客网 时间:2024/04/29 16:39
http://blog.sina.com.cn/s/blog_4ac0a0d30100qlec.html
//**********工程1 dll************//精简dll lib.cpp#include "windows.h"#include "stdio.h"int _stdcall add(int x,int y){return x + y;}char* _stdcall msg(char *words){static char buffer[]="ddddddddddddddddddd";return buffer;}//精简dll lib.defLIBRARY LIBEXPORTSadd @ 1msg @ 2//************工程2 调用dll******************//精简dll 调用#include <stdafx.h>typedef char* (__stdcall *dFunc)(char *words);main(){HINSTANCE dHand;dFunc mess;dHand=::LoadLibrary("K:\\mess.dll");printf("%d",dHand);mess=(dFunc)::GetProcAddress(dHand,"message");mess("abc");::FreeLibrary(dHand);}

mfc Dll 一样的可以参考

http://wenku.baidu.com/view/256bebf3f90f76c661371abb.html###

1.在Class增加函数

2.def中声明


原创粉丝点击