SetVariable & DLL

Hi

{
if object OracleDataSet is stored in EXE and to call method SetVariable from DLL then
raise exception EInvalidCast.
In main application all OK.
Exsamples see bellow}

library LibDOA;

uses
Sharemem,
OracleData;

procedure SetVarODS(var ods: TOracleDataSet);stdcall;
begin
with ods do
begin
Close;
// in main program:
// SQL = 'select * from otn.type_objects where type_object=:TypeOb'
// DeclareVariable('TypeOb', otInteger);
SetVariable('TypeOb',5); // EInvalidCast
{ in string module OracleTypes:
Result := List.Items[Index] as TVariableData;}
Open;
end;
end;

exports SetVarODS;

begin
end.

{ call library
procedure TForm1.Button1Click(Sender: TObject);
type
TSetVarODS = procedure(var ods: TOracleDataSet);stdcall;
var
SetVarODS : TSetVarODS;
begin
@SetVarODS := GetProcAddress(DLLInstance, 'SetVarODS');
SetVarODS(OracleDataSet1);
end;}
 
It seems like a memory management bug (sharemem?). Perhaps you can use the TOracleSession.Share method or TOracleSession.ExternalSVC property to isolate the Host and DLL memory as much as possible?

------------------
Marco Kalter
Allround Automations
 
I need to receive access from DLL to objects EXE of the module. In DLL the objects of class TOracleSession & TOracleDataSet don't is stored.
Thank you for help.
Dmitry.
Ryazan NPZ.
 
Back
Top