在动态链接库中大概是这么写的:
暴露出来的函数是:
GetHelloInit; 函数原型是: function GetHelloInit: IDemoIntef; stdcall; 用来创建一个IDemoIntef类型的对象
定义了一个 类 TDemoIntf = Class(TInterfacedObject,IDemoIntef) 其中包含了一些接口中的函数。
IDemoIntef 是 子定义的一个接口
var
_IDemoIntef : IDemoIntef; //这是个全局变量,接口类型function GetHelloInit: IDemoIntef; stdcall;
begin
try
if not Assigned(_IDemoIntef) then
begin
_IDemoIntef := Tdemointf.Create;
end;
finally
end;
Result := _IDemoIntef;
end;现在的问题是: 为什么我用两个函数 同时调用这个动态链接库的时候总是会创建两个 _IDemoIntef 这样的对象呢?
望高手给予指点啊
暴露出来的函数是:
GetHelloInit; 函数原型是: function GetHelloInit: IDemoIntef; stdcall; 用来创建一个IDemoIntef类型的对象
定义了一个 类 TDemoIntf = Class(TInterfacedObject,IDemoIntef) 其中包含了一些接口中的函数。
IDemoIntef 是 子定义的一个接口
var
_IDemoIntef : IDemoIntef; //这是个全局变量,接口类型function GetHelloInit: IDemoIntef; stdcall;
begin
try
if not Assigned(_IDemoIntef) then
begin
_IDemoIntef := Tdemointf.Create;
end;
finally
end;
Result := _IDemoIntef;
end;现在的问题是: 为什么我用两个函数 同时调用这个动态链接库的时候总是会创建两个 _IDemoIntef 这样的对象呢?
望高手给予指点啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货