A
angelwork
Unregistered / Unconfirmed
GUEST, unregistred user!
我是第一次学习动态连接库的使用,在使用中发现了一个问题:我试验的开发了一个用于
计算的窗体,其DLL定义如下:
library Project1;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes;
{$R *.res}
//两个整数求最大值
function MaxNum(x,y:integer):integer;stdcall;
begin
if x>y then
result:=x
else
result:=y;
end;
//两个整数求最小值
function MinNum(x,y:integer):integer;stdcall;
begin
if x>y then
result:=y
else
result:=x;
end;
// 两个整数相乘
function MulNum(x,y:integer):integer;stdcall;
begin
result:=x*y;
end;
//两个整数相加
function PlusNum(x,y:integer):integer;stdcall;
begin
result:=x+y;
end;
//两个整数相减
function MinusNum(x,y:integer):integer;stdcall;
begin
result:=x-y;
end;
//导出表
exports
[red] MinNum;[/red]
begin
end.
在Dll接口部分定义出口时,为什么我只能够定义一个接口(MinNum)呢?如果在添加一个
MaxNum就提示错误!请问高手,这样的问题该如何解决呢?谢谢!
计算的窗体,其DLL定义如下:
library Project1;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes;
{$R *.res}
//两个整数求最大值
function MaxNum(x,y:integer):integer;stdcall;
begin
if x>y then
result:=x
else
result:=y;
end;
//两个整数求最小值
function MinNum(x,y:integer):integer;stdcall;
begin
if x>y then
result:=y
else
result:=x;
end;
// 两个整数相乘
function MulNum(x,y:integer):integer;stdcall;
begin
result:=x*y;
end;
//两个整数相加
function PlusNum(x,y:integer):integer;stdcall;
begin
result:=x+y;
end;
//两个整数相减
function MinusNum(x,y:integer):integer;stdcall;
begin
result:=x-y;
end;
//导出表
exports
[red] MinNum;[/red]
begin
end.
在Dll接口部分定义出口时,为什么我只能够定义一个接口(MinNum)呢?如果在添加一个
MaxNum就提示错误!请问高手,这样的问题该如何解决呢?谢谢!