- pexports -o lua5.1.dll >lua5.1.def
dlltool -D lua5.1.dll -l lua5.1.a -d lua5.1.def -
#include<stdio.h>
#include<malloc.h>
#include<assert.h>
typedefvoid(__stdcall*func_call)();
void__stdcallfoo(inta,intb)
...{
printf("%d,%d ",a,b);
}
voidcheck(void*arg)
...{
assert((void**)arg-&arg==1);
}
voidtest()
...{
int*arg=(int*)_alloca(2*sizeof(int));
arg[0]=1;
arg[1]=2;
check(arg);
((func_call)foo)();
}

voidmain()
...{
test();
}
MinGw 生成Dll的连接库 无参数调用
最新推荐文章于 2024-06-04 20:12:11 发布
本文介绍了一个使用pexports工具导出Lua 5.1 DLL的示例,并展示了如何通过C语言调用DLL中的函数。示例中包含了定义、声明及具体的函数调用过程。
1万+

被折叠的 条评论
为什么被折叠?



