From 128e2e9cc5dc38127ade8e85f52ca57ab0f6f577 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 1 Jul 2011 10:08:40 +0000 Subject: [PATCH] *Dll_entry: Call SysInitMultiThreading to allocate TlsKey if not yet done git-svn-id: trunk@17892 - --- rtl/win/syswin.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rtl/win/syswin.inc b/rtl/win/syswin.inc index 1ea914b43b..5fda6a3b87 100644 --- a/rtl/win/syswin.inc +++ b/rtl/win/syswin.inc @@ -52,6 +52,8 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry begin if Win32GetCurrentThreadId <> MainThreadIdWin32 then begin + { Initialize multithreading if not done } + SysInitMultithreading; { Allocate Threadvars } SysAllocateThreadVars; @@ -76,8 +78,8 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry DLL_PROCESS_DETACH : begin Dll_entry:=true; { return value is ignored } - if MainThreadIDWin32=0 then // already been here. - exit; + if MainThreadIDWin32=0 then // already been here. + exit; If SetJmp(DLLBuf) = 0 then FPC_Do_Exit; if assigned(Dll_Process_Detach_Hook) then @@ -86,7 +88,7 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry DoneThread; { Free TLS resources used by ThreadVars } SysFiniMultiThreading; - MainThreadIDWin32:=0; + MainThreadIDWin32:=0; end; end; end;