diff --git a/rtl/win64/system.pp b/rtl/win64/system.pp index c004035888..497fdd3ae7 100644 --- a/rtl/win64/system.pp +++ b/rtl/win64/system.pp @@ -601,8 +601,8 @@ begin GetStartupInfo(@startupinfo); { some misc Win32 stuff } if not IsLibrary then - SysInstance:=getmodulehandle(nil); - MainInstance:=SysInstance; + FPCSysInstance^:=getmodulehandle(nil); + MainInstance:=FPCSysInstance^; cmdshow:=startupinfo.wshowwindow; { Setup heap and threading, these may be already initialized from TLS callback } if not Assigned(CurrentTM.BeginThread) then