关于BCB下一个Dll的问题

lzwcom 2003-03-24 10:24:07
我在BCB编译一个Dll文件,另一个程序(也用BCB写的)静态捆绑这个Dll文件,我把生成的Lib文件加入到了工程中,但链接时说我的函数找不到,请指教
//----dll.h----
bool init();
bool release();
//-------------

//----dllmain.cpp---
#include "dll.h"
bool init()
{
...
}
bool release()
{
...
}
//======调用Dll的程序=====
//------main.cpp----
#include "dll.h"
void __fastcall TMainForm::DoInitClick(TObject* sender)
{
Init();
}

//====结果连接时出现错误====
[Linker Error] Unresolved external ' init()' referenced from ..main.OBJ
请问为什么
我已经将生成的LIb文件加入到了工程中
...全文
28 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kataboy 2003-03-24
  • 打赏
  • 举报
回复
最好是:
DLL 中 extern "C" __declspec(dllexport) bool __stdcall init();

调用 DLL 中 extern "C" __declspec(dllimport) bool _stdcall init();
你试试!
lzwcom 2003-03-24
  • 打赏
  • 举报
回复
问题解决:
extern "C" __declspec(dllimport) bool init();

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧