一个问题,请帮忙

_guanri 2001-06-06 03:12:00
extern "C"
{
class __declspec(dllexport)test
{
public:
int x;
int y;
test();
~test();
void wtest(int z);
private :
void do_wtest(int w);

};
}这是在vc中用的头文件
extern "C"
{
test::test(){x=0;y=0;};
test::~test(){};
void test::wtest(int z)
{
do_wtest(z);
};
void test::do_wtest(int w)
{
x=w;
};
}这是在vc中用的源文件,在vc中生成wdll.dll
extern "C"
{
class __declspec(dllimport) test
{
public:
int x;
int y;
test();
~test();
void wtest(int z);
private :
void do_wtest(int w);

};
}这是在bcb中用的头文件
#include <vcl.h>
#pragma hdrstop
#include "wdll.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
test td;
td.wtest(34);
}这是BCB的源文件
这是在BCB中用静态调用VC产生的DLL
出错位
[Linker Error] Unresolved external 'test::~test()' referenced from H:\VC\WDLL\UNIT1.OBJ
[Linker Error] Unresolved external 'test::test()' referenced from H:\VC\WDLL\UNIT1.OBJ
[Linker Error] Unresolved external 'test::wtest(int)' referenced from H:\VC\WDLL\UNIT1.OBJ
所需的WDLL.LIB 我也手工生成
请大家帮忙
...全文
92 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
_guanri 2001-06-06
  • 打赏
  • 举报
回复
什么c++呀,什么风装呀,什么继承呀,全让她们滚一边吧,以后再也不想类了.我恨死发明c++的人了
holyfire 2001-06-06
  • 打赏
  • 举报
回复
BCB在DLL中使用VC的导入类不简单,因为要使用类就要用CPP命名方式,这会使用名字分裂,而VC和BCB的名字分裂是不一样的。

提供一篇文章,专门将如何解决这个问题的。
http://www.bcbdev.com/articles/vcdll2.htm
_guanri 2001-06-06
  • 打赏
  • 举报
回复
加了呀,class __declspec(dllimport) test
xycleo 2001-06-06
  • 打赏
  • 举报
回复
你还没加上dllImport的说明吧!!!

13,870

社区成员

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

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