{ 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,Spcomm , Windows,
Classes;
type
TCommOper = procedure (buff:Array of Byte);stdcall ;
var
comm : TComm;
comm_oper : TCommOper;
procedure Comm_recv(Sender:TObject; buffer:Pointer; length:Word);
var buf: array of Byte;
begin
SetLength(buf, length);
CopyMemory(@buf[0], buffer, length);
comm_oper(buf);
end;
procedure Comm_init(name:string; baudrate:SmallInt; c_oper: TCommOper); stdcall ;
begin
comm.CommName := name;
comm.BaudRate := baudrate;
comm_oper := @c_oper;
try
comm.StartComm;
except
end;
comm.Outx_XonXoffFlow := False;
comm.Inx_XonXoffFlow := False;
comm.OnReceiveData := Comm_recv;
end;
{$R *.res}
begin
end.
[/code]
编译的时候在comm.OnReceiveData这行报method pointer and regular procedure错。应该怎么解决