报错内容:
说"Ox...."指令引用的"Ox....."内存,内存不能为Read代码:
Procedure AutoIDConnection(x:TADOConnection;EnterID:String);
begin
EnterpriseID:=EnterID;
Connection:=x;
ADOQuery_Comm:=TADOQuery.Create(nil);
ADOQuery_Comm.Connection:=Connection;
ADOQuery_Comm.Close;
end;
参数类型改成这样就没事
Procedure AutoIDConnection(x:TADOConnection;EnterID:PChar);
begin
EnterpriseID:=EnterID;
Connection:=x;
ADOQuery_Comm:=TADOQuery.Create(nil);
ADOQuery_Comm.Connection:=Connection;
ADOQuery_Comm.Close;
end;
说"Ox...."指令引用的"Ox....."内存,内存不能为Read代码:
Procedure AutoIDConnection(x:TADOConnection;EnterID:String);
begin
EnterpriseID:=EnterID;
Connection:=x;
ADOQuery_Comm:=TADOQuery.Create(nil);
ADOQuery_Comm.Connection:=Connection;
ADOQuery_Comm.Close;
end;
参数类型改成这样就没事
Procedure AutoIDConnection(x:TADOConnection;EnterID:PChar);
begin
EnterpriseID:=EnterID;
Connection:=x;
ADOQuery_Comm:=TADOQuery.Create(nil);
ADOQuery_Comm.Connection:=Connection;
ADOQuery_Comm.Close;
end;
如要用string类型,必须再单元中uses sharemem,动态链接库和应用程序都加上
为了能让其他的程序能够调用dll中的过程,要输出的过程最好采用stdcall调用约定。而且被其他语言调用的时候,过程参数类型和返回类型必须是其他语言中的合法数据类型
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
ShareMem,
在工程里面也要首先引用
uses
ShareMem,
用PChar类型参数,好象borland公司说PChar类型不安全,是这样吗?
String类型的就没有结尾符号,所以不可以作动态库参数传递,是不安全的