在Dll中调用ocx出错
我在用delphi写的dll中调用了ocx控件,dll的导出函数用到了widestring
Dll入口函数
procedure DLLEntryPoint(dwReason: DWord);stdcall;
begin
case dwReason of
DLL_PROCESS_ATTACH:
begin
CoInitialize(NIL);
ICSeat:= CreateOleObject('ICC.IC_S') as IC_Seat;
end;
DLL_PROCESS_DETACH:
begin
CounInitialize;
end;
DLL_THREAD_ATTACH: ;
DLL_THREAD_DETACH: ;
end;
end;
两个导出函数
function Ding_Ring(DR_Port_Com: Smallint; DR_Num: Byte; DR_Time: Byte): Smallint; stdcall;
begin
result := ICSeat.Ding_Ring(DR_Port_Com, DR_Num, DR_Time);
//这句可以调用 但返回的时候出错 too many consecutive exceptions 'access violation at 0x.....
end;
function Read_Card(RC_Port_Com: Smallint; var RC_Str_Card: WideString): Smallint; stdcall;
begin
result := ICSeat.Read_Card(RC_Port_Com, RC_Str_Card);
end;
调用任何一个使用了ICSeat的导出函数都会出错
too many consecutive exceptions 'access violation at 0x.....
原本怀疑是dll导出函数的参数用了string的原因
后 在dll的project文件及测试dll的exe文件都有调用SharMem(放在第一个),还是出错
请高手帮忙指点一下