Function ReadCard(key_type:LongInt;key:String;block_no:LongInt):String;
var ret:LongInt;
i:Integer;
data:String;
begin
SetLength(data,32);
ret:=ReadCard(key_type,key,block_no,data);
if ret=0 then
begin
data := Asc2ToHex1(data);
end
else
begin
data := '所读数据有错误';
end; //showmessage('成功');
result:=data;
end;当不加showmessage('成功')时,提示错误,且显示
project reij.exe raised exception class EINvalidPointer with message 'Invoid pointer operation.'process stopped.Use Step or to continue.
而加上showmessage('成功')时,就没有错误了
这难道是delphi的bug吗
这是理由
{ 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. }