I have a dll made in delphi 2010, and sometimes the "Invalid pointer operation" error occurs when creating the data module, which contains dbexpress connection components (simpledataset, sqlconnection, clientdataset, etc, as well as some components of the rave report). The dll works 90% of the time, but sometimes it generates the error.
The application that calls the tbl dll is done in delphi 2010. I did a lot of research on google, but I never saw this error when creating a data module, usually people find this error when giving a .free or when leaving the application , but in my case it is the CREATE data module.
I have tried to put SimpleShareMem as 1st. use statements, both in the dll source and in the source of the exe calling it, same error ...
It happens like this:
- application starts and calls DLL function, works normal, close application
- application starts and calls DLL function, works normal, close application
- application starts and calls DLL function, ERROR , close application
- application starts and calls DLL function, works normal, close application
- and so on ...
The messages are not always the same, that intrigues me:
- invalid pointer operation, OR
- error reading sqlTable1FIELD1.FieldName: invalid pointer operation, OU
- error reading sqlTable1FIELD1.SQLConnection: property 0RAVECOMPLETED does not exist
- Class TSmallIntField not found
Any suggestions?
function Imp1(vEmp: Integer): boolean; export; stdcall;
var Registry: TRegistry;
begin
with dmNFD2 do
begin
try
p_NumEmp := vEmp;
result := True;
if not(Assigned(dmNFD2)) then
//Application.CreateForm(TdmNFD2,dmNFD2); // erro aqui ou
dmNFD2 := TdmNFD2.Create(nil); // erro aqui
if not(dmNFD2.sqlConn.Connected) then
begin
ConnectBD; // le o registro do windows (path, user e password database)
end;
if dmNFD2.sqlConn.Connected then
begin
qryGen.Close;
qryGen.SQL.Text := 'select CAMPO from TABELA where PARNUM = :PARNUM';
qryGen.Params.ParamByName('PARNUM').AsInteger := p_NumEmp;
qryGen.Open;
// insert or update in other table
// ....
end;
except
on e:Exception do
begin
result := False;
end;
end;
end;