[Lazarus] Mutlithreaded Dll Callback crashes my Application

José Mejuto joshyfun at gmail.com
Wed Aug 25 21:29:16 CEST 2010


Hello Lazarus-List,

Wednesday, August 25, 2010, 8:24:38 PM, you wrote:

AG> I have tried to reduce the DLL problem into a test that doesn't need any
AG> external DLL. It crashes too.
AG> Here's the test program:

Change "somefunc" by:

procedure someFunc(param: pointer); cdecl;
var
  t: tobject;
  a: string;
begin
//  WriteLn('External is called - ThreadID=', GetCurrentThreadId);
//  if assigned(param) then writeln('blub');
//  writeln('param=', integer(param));

  t := TObject.Create;
  try
    a:=TObject.ClassName;
    FileWrite(StdOutputHandle,a[1],Length(a));
  finally
    t.Free;
  end;

  someObj.someMethod(integer(param));
end;

And it works, so the problem is not in the RTL itself, but in the
writeln in a multithread environment.

-- 
Best regards,
 José





More information about the Lazarus mailing list