Alexander,

Try the following to limit the problem: in your callback do not call *ANY* FPC runtime related code - Just a "Win32 MessagBox(0, "hi", "text", MB_OK)". Add the process id (GetProcessId) to that dialog output and also in your main program (to see if you are really in an external thread).

I am in an external thread.
If that works, call a simple global FPC function (no object) and again just that callback there.

After that works, just a simple FPC object call and again that message box.

I still assume in the compiler version you are using, you simply can't call FPC objects inside external threads.
this is the full code of the callback

procedure ExecuteCommandClb(tmlhandle : TML_COMMAND_HANDLE; pCBData : Pointer); cdecl;
var
 hsidex : SIDEX_HANDLE;
 val    : SIDEX_VARIANT;
begin
 tml_Cmd_Get_Sidex_Handle(tmlhandle,@hsidex);
 if assigned(hsidex) then
 begin
   val := sidex_Variant_New_Boolean(true) ;
   sidex_Variant_Write(hsidex,'Answer', 'Accept', val);
   sidex_Variant_DecRef(val);
 end;
end;

no FPC objects are called. I've thought that this might be the reason and changed the code to try, but it didn't work either.
All calls are API calls of my dll.

Also have a look at the mantis - e.g. see if 0012987 is related to your problem? (http://bugs.freepascal.org/view.php?id=12987)
This sounds pretty much like my problem.
I'm new to lazarus and I've downloaded the installer package as it is. Can I change the FPC Compiler without changing my current IDE and how can I do this ? I think it might be a good idea to use the current version to double check if the problem is still there. The latest release is 2.4.0. Why does the lazarus installer for windows install 2.2.4, it seems a little bit out of date ?


I might be fully wrong with my assumptions, I'm just thinking loudly because I had the same issue - just another architecture :-)
I am happy about any hint to solve this one. The dll is already ported to Linux and Mac OS-X and I've decided to use lazarus for
some demo applications.

Maik

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to