delphi中如何调用obj

whanlx 2004-11-01 11:54:05
需要在delphi6程序中调用bcb写的obj
本人对delphi和bcb都不熟,我用的obj就是bcb程序为了生成lib而生成的那个obj
但是在delphi中调用显示找不到函数
大侠帮忙:

我的调用代码: run.obj是obj的文件名
{$L Run.OBJ}
procedure Rt();cdecl; external;
procedure Rs();cdecl; external;

错误代码:
[Error] main.pas(16): Unsatisfied forward or external declaration: 'Rt'
[Error] main.pas(21): Unsatisfied forward or external declaration: 'Rs'
[Error] main.pas(555): Unsatisfied forward or external declaration: '_strcmp'
[Error] main.pas(555): Unsatisfied forward or external declaration: '_strcpy'
[Error] main.pas(555): Unsatisfied forward or external declaration: '_strlen'

是我的bcb的obj不对还是我delphi调用的不对啊 我的bcb生成的lib没有问题
谢谢
...全文
503 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
tonylk 2004-11-02
  • 打赏
  • 举报
回复
好像应该这样哦:

procedure Rt();stdcall; external;
procedure Rs();stdcall; external;
{$L Run.OBJ}
whanlx 2004-11-01
  • 打赏
  • 举报
回复
急啊
whanlx 2004-11-01
  • 打赏
  • 举报
回复
xi谢谢
whanlx 2004-11-01
  • 打赏
  • 举报
回复
谢谢楼上的,但是还是不行啊
是不是我的cb有问题
我的cb代码:
extern "C" void _stdcall Rt()
{

}
extern "C" int _stdcall Rs()
{
return 0;
}

这个是我的delphi代码:
unit test;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;

procedure Rt();cdecl; external;
{$L R.OBJ}

var
Form1: TForm1;

implementation

{$R *.dfm}

end.
错误:Error] main.pas(16): Unsatisfied forward or external declaration: 'Rt'


tonylk 2004-11-01
  • 打赏
  • 举报
回复
{$L Run.OBJ}
procedure Rt();cdecl; external;
procedure Rs();cdecl; external;

应该反过来写:
procedure Rt();cdecl; external;
procedure Rs();cdecl; external;
{$L Run.OBJ}
zwb666 2004-11-01
  • 打赏
  • 举报
回复
没用过

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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