[Lazarus] Mutlithreaded Dll Callback crashes my Application

José Mejuto joshyfun at gmail.com
Wed Aug 25 21:33:02 CEST 2010


Hello Lazarus-List,

Wednesday, August 25, 2010, 8:47:23 PM, you wrote:

SB> IsMultiThread is only a variable. Setting it is only useful recognized
SB> once FPC threading code is called. So instead of setting IsMultiThread
SB> to true you must create at least one thread in FPC (it can be a dummy
SB> thread that immediately terminates).

In Delphi setting IsMultithread to true is a must to use non TThread
threads. Taken from Embarcadero QA:

Question:
Why do I get "Access violation" or "invalid pointer
operation" when doing multi-threading in Delphi when not using the
TThread class or the BeginThread function (i.e. using the CreateThread
API function, or writing an Entera server)?

Answer:
If you use non-Delphi threads (not using TThread or
BeginThread) in a Delphi application, then you must manually set the
IsMultiThread variable from the System unit to true. See
"IsMultiThread variable" in the online help files for more
information.

Also the one thread creation is only for Unix systems, win32 does not
have this problem since a lot of time.

On the other hand, if Unix needs one thread creation then it should be
automagically done in the initialization section of cthreads, do not ?

-- 
Best regards,
 José





More information about the Lazarus mailing list