interface
function ReturnSz(var TmpKh : longint):Integer; export;
implementation
function ReturnSz(var TmpKh : longint):Integer;
begin
tmpkh:=12345; //向返回变量赋值是出错。
result :=0;
end;
end.
...全文
989打赏收藏
在线等待:一个带返回值的函数,请高手指正!
unit Unit1; interface function ReturnSz(var TmpKh : longint):Integer; export; implementation function ReturnSz(var TmpKh : longint):Integer; begin tmpkh:=12345; //向返回变量赋值是出错。 result :=0; end; end.
{ 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,
Unit11 in 'Unit11.pas';
{$R *.res}
exports
ReturnSZ;
begin
end.
-----------------------------DLL单元文件--------------------------------
unit Unit1;
interface
function ReturnSZ(var TmpKh : LongInt):Integer; Export;
implementation
function ReturnSZ(var TmpKh : LongInt):Integer;
begin
Tmpkh:=12345;
Result :=0;
end;