这么简单的动态链接库为何就是会调用失败??有源码

ycgx 2003-06-23 11:56:39
library Realtimeproc;

uses
SysUtils,
Classes;

{$R *.RES}
function min(x,y:integer):integer; export;
begin
if x<y then Min:=x else Min:=y;
end;
function max(x,y:integer):integer; export;
begin
if x>y then max:=x else max:=y;
end;

exports
min index 1 name 'min',
max index 2 name 'max';

begin
end.

通过 import Type library...菜单项导入失败....
...全文
48 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xikug 2003-08-15
  • 打赏
  • 举报
回复
改为:

library Realtimeproc;

uses
SysUtils,
Classes;

{$R *.RES}
function min(x,y:integer):integer; stdcall;
begin
if x<y then Min:=x else Min:=y;
end;
function max(x,y:integer):integer; stdcall;
begin
if x>y then max:=x else max:=y;
end;

exports
min index 1 name 'min',
max index 2 name 'max';

begin
end.

就行了
leonkim 2003-08-15
  • 打赏
  • 举报
回复
把你的function Min(x,y:integer):integer;far;external 'realtimeproc';
中的Min,改为min就行了.
在dll输出的函数名称区分大小写.
cybjrf 2003-06-24
  • 打赏
  • 举报
回复
library Realtimeproc;

uses
sharemem,
SysUtils,
Classes;

在uses中加个sharemem引用就可以了
ycgx 2003-06-24
  • 打赏
  • 举报
回复
高手请出招救啊
ycgx 2003-06-24
  • 打赏
  • 举报
回复
我按楼上讲的改为StdCall了,还是不行,晕倒.....
我用的是DELPHI5
ycgx 2003-06-24
  • 打赏
  • 举报
回复
sharemem我加入,还是不行啊!!!!

后来改为代码调用,代码出下:
...
implementation
function Min(x,y:integer):integer; far; external 'Realtimeproc.dll';
//动态链接库与应用程序放在同一目录
...
procedure ....
begin
label1.Caption := IntToStr(Min(10,15));
...
end;
--------------------------------------
程序一运行就提示"无法定位程序输入点Min于动态链接库Realtimeproc.dll上",不知为何?
nyxi 2003-06-24
  • 打赏
  • 举报
回复
export已经过时建议用StdCall;
function Min(X, Y: Integer): Integer;StdCall;
begin
if X < Y then Min:= X else Min:= Y;
end;

function Max(X, Y: Integer): Integer;StdCall;
begin
if X > Y then Max:= X else Max:= Y;
end;
knock 2003-06-24
  • 打赏
  • 举报
回复
我试一下,也fail了

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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