* integrate loaders in system unit

git-svn-id: trunk@2695 -
This commit is contained in:
peter 2006-02-26 18:21:35 +00:00
parent b309574e22
commit 4c56a87d59
8 changed files with 150 additions and 77 deletions

View File

@ -898,15 +898,15 @@ begin
{$else ARM}
targetopts:='-b pe-i386 -m i386pe';
{$endif ARM}
ExeCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $STRIP $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
DllCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $STRIP --dll $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
ExeCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $STRIP $APPTYPE $ENTRY $IMAGEBASE $RELOC -o $EXE $RES';
DllCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $STRIP --dll $APPTYPE $ENTRY $IMAGEBASE $RELOC -o $EXE $RES';
{ ExeCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF';
use short forms to avoid 128 char limitation problem }
ExeCmd[2]:='dlltool -S $ASBIN -D $EXE -e exp.$$$ $RELOC $DEF';
ExeCmd[3]:='ld '+targetopts+' $OPT $STRIP $APPTYPE $IMAGEBASE -o $EXE $RES exp.$$$';
ExeCmd[3]:='ld '+targetopts+' $OPT $STRIP $APPTYPE $ENTRY $IMAGEBASE -o $EXE $RES exp.$$$';
{ DllCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF'; }
DllCmd[2]:='dlltool -S $ASBIN -D $EXE -e exp.$$$ $RELOC $DEF';
DllCmd[3]:='ld '+targetopts+' $OPT $STRIP --dll $APPTYPE $IMAGEBASE -o $EXE $RES exp.$$$';
DllCmd[3]:='ld '+targetopts+' $OPT $STRIP --dll $APPTYPE $ENTRY $IMAGEBASE -o $EXE $RES exp.$$$';
end;
end;
@ -951,6 +951,7 @@ begin
{ add objectfiles, start with prt0 always }
{ profiling of shared libraries is currently not supported }
LinkRes.Add('INPUT(');
(*
if isdll then
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('wdllprt0','',false)))
else
@ -963,6 +964,7 @@ begin
else
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('wprt0','',false)));
end;
*)
while not ObjectFiles.Empty do
begin
@ -1040,6 +1042,7 @@ var
StripStr,
RelocStr,
AppTypeStr,
EntryStr,
ImageBaseStr : string[40];
begin
if not(cs_link_extern in aktglobalswitches) then
@ -1048,27 +1051,30 @@ begin
{ Create some replacements }
RelocStr:='';
AppTypeStr:='';
EntryStr:='';
ImageBaseStr:='';
StripStr:='';
GCSectionsStr:='';
AsBinStr:=FindUtil(utilsprefix+'as');
if RelocSection then
RelocStr:='--base-file base.$$$';
RelocStr:='--base-file base.$$$';
if use_smartlink_section then
GCSectionsStr:='--gc-sections';
GCSectionsStr:='--gc-sections';
if target_info.system in [system_arm_wince,system_i386_wince] then
begin
AppTypeStr:='--subsystem wince';
if apptype <> app_gui then
AppTypeStr:=AppTypeStr + ' --entry=mainCRTStartup';
end
AppTypeStr:='--subsystem wince'
else
if apptype=app_gui then
AppTypeStr:='--subsystem windows';
begin
if apptype=app_gui then
AppTypeStr:='--subsystem windows';
end;
if apptype=app_gui then
EntryStr:='--entry=_WinMainCRTStartup'
else
EntryStr:='--entry=_mainCRTStartup';
if assigned(DLLImageBase) then
ImageBaseStr:='--image-base=0x'+DLLImageBase^;
ImageBaseStr:='--image-base=0x'+DLLImageBase^;
if (cs_link_strip in aktglobalswitches) then
StripStr:='-s';
StripStr:='-s';
{ Write used files and libraries }
WriteResponseFile(false);
@ -1088,6 +1094,7 @@ begin
Replace(cmdstr,'$OPT',Info.ExtraOptions);
Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
Replace(cmdstr,'$APPTYPE',AppTypeStr);
Replace(cmdstr,'$ENTRY',EntryStr);
Replace(cmdstr,'$ASBIN',AsbinStr);
Replace(cmdstr,'$RELOC',RelocStr);
Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
@ -1135,6 +1142,7 @@ var
GCSectionsStr,
RelocStr,
AppTypeStr,
EntryStr,
ImageBaseStr : string[40];
begin
MakeSharedLibrary:=false;
@ -1144,6 +1152,7 @@ begin
{ Create some replacements }
RelocStr:='';
AppTypeStr:='';
EntryStr:='';
ImageBaseStr:='';
StripStr:='';
GCSectionsStr:='';
@ -1153,11 +1162,16 @@ begin
if use_smartlink_section then
GCSectionsStr:='--gc-sections';
if apptype=app_gui then
AppTypeStr:='--subsystem windows';
begin
AppTypeStr:='--subsystem windows';
EntryStr:='--entry _DLLWinMainCRTStartup@12'
end
else
EntryStr:='--entry _DLLMainCRTStartup@12';
if assigned(DLLImageBase) then
ImageBaseStr:='--image-base=0x'+DLLImageBase^;
ImageBaseStr:='--image-base=0x'+DLLImageBase^;
if (cs_link_strip in aktglobalswitches) then
StripStr:='-s';
StripStr:='-s';
{ Write used files and libraries }
WriteResponseFile(true);
@ -1177,6 +1191,7 @@ begin
Replace(cmdstr,'$OPT',Info.ExtraOptions);
Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
Replace(cmdstr,'$APPTYPE',AppTypeStr);
Replace(cmdstr,'$ENTRY',EntryStr);
Replace(cmdstr,'$ASBIN',AsbinStr);
Replace(cmdstr,'$RELOC',RelocStr);
Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);

View File

@ -802,7 +802,7 @@ begin
{$ifdef windows}
{ inside stack ? }
if (ptruint(p)>ptruint(get_frame)) and
(ptruint(p)<Win32StackTop) then
(p<StackTop) then
goto _exit;
{ inside data ? }
if (ptruint(p)>=ptruint(@sdata)) and (ptruint(p)<ptruint(@edata)) then

View File

@ -44,7 +44,6 @@ const
var
emptychar : char;public name 'FPC_EMPTYCHAR';
initialstklen : SizeUint;external name '__stklen';
initialstkptr : Pointer;external name '__stkptr';
{ checks whether the given suggested size for the stack of the current
thread is acceptable. If this is the case, returns it unaltered.

View File

@ -1,6 +1,6 @@
{
This file contains the OS independent declarations of the system unit
This file is part of the Free Pascal Run time library.
Copyright (c) 1999-2005 by the Free Pascal development team
@ -349,6 +349,7 @@ ThreadVar
StdErr : Text;
InOutRes : Word;
{ Stack checking }
StackTop,
StackBottom : Pointer;
StackLength : SizeUInt;

View File

@ -249,6 +249,9 @@ begin
result := stklen;
end;
var
initialstkptr : Pointer;external name '__stkptr';
Begin
SysResetFPU;
IsConsole := TRUE;

View File

@ -1,8 +1,8 @@
#
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/04]
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/20]
#
default: all
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
BSDs = freebsd netbsd openbsd darwin
UNIXs = linux $(BSDs) solaris qnx
LIMIT83fs = go32v2 os2 emx watcom
@ -239,8 +239,8 @@ COMMON=$(RTL)/common
PROCINC=$(RTL)/$(CPU_TARGET)
WININC=wininc
UNITPREFIX=rtl
ifdef RELEASE
override FPCOPT+=-Ur
ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
LOADERS=wprt0 wdllprt0 gprt0 wcygprt0
endif
OBJPASDIR=$(RTL)/objpas
include $(WININC)/makefile.inc
@ -281,6 +281,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override TARGET_UNITS+=system ctypes objpas macpas strings lineinfo heaptrc matrix windows winsock initc cmem dynlibs signals dos crt objects messages rtlconsts sysconst sysutils math types strutils convutils dateutils varutils variants typinfo classes cpu mmx charset ucomplex getopts winevent sockets printer video mouse keyboard winsysut fpmkunit
endif
ifeq ($(FULL_TARGET),i386-darwin)
override TARGET_UNITS+=system ctypes objpas macpas strings lineinfo heaptrc matrix windows winsock initc cmem dynlibs signals dos crt objects messages rtlconsts sysconst sysutils math types strutils convutils dateutils varutils variants typinfo classes cpu mmx charset ucomplex getopts winevent sockets printer video mouse keyboard winsysut fpmkunit
endif
ifeq ($(FULL_TARGET),i386-emx)
override TARGET_UNITS+=system ctypes objpas macpas strings lineinfo heaptrc matrix windows winsock initc cmem dynlibs signals dos crt objects messages rtlconsts sysconst sysutils math types strutils convutils dateutils varutils variants typinfo classes cpu mmx charset ucomplex getopts winevent sockets printer video mouse keyboard winsysut fpmkunit
endif
@ -360,118 +363,121 @@ ifeq ($(FULL_TARGET),powerpc64-linux)
override TARGET_UNITS+=system ctypes objpas macpas strings lineinfo heaptrc matrix windows winsock initc cmem dynlibs signals dos crt objects messages rtlconsts sysconst sysutils math types strutils convutils dateutils varutils variants typinfo classes cpu mmx charset ucomplex getopts winevent sockets printer video mouse keyboard winsysut fpmkunit
endif
ifeq ($(FULL_TARGET),i386-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-go32v2)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-win32)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-os2)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-freebsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-beos)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-netbsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-solaris)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-qnx)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-netware)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-openbsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-wdosx)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-darwin)
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-emx)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-watcom)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-netwlibc)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-wince)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-freebsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-netbsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-amiga)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-atari)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-openbsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),m68k-palmos)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),powerpc-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),powerpc-netbsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),powerpc-macos)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),powerpc-darwin)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),powerpc-morphos)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),sparc-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),sparc-netbsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),sparc-solaris)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),x86_64-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),x86_64-freebsd)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),x86_64-win64)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),arm-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),arm-palmos)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),arm-wince)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override TARGET_LOADERS+=wprt0 wdllprt0 gprt0 wcygprt0
override TARGET_LOADERS+=$(LOADERS)
endif
ifeq ($(FULL_TARGET),i386-linux)
override TARGET_RSTS+=math varutils typinfo variants classes dateutils sysconst fpmkunit
@ -509,6 +515,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override TARGET_RSTS+=math varutils typinfo variants classes dateutils sysconst fpmkunit
endif
ifeq ($(FULL_TARGET),i386-darwin)
override TARGET_RSTS+=math varutils typinfo variants classes dateutils sysconst fpmkunit
endif
ifeq ($(FULL_TARGET),i386-emx)
override TARGET_RSTS+=math varutils typinfo variants classes dateutils sysconst fpmkunit
endif
@ -624,6 +633,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
endif
ifeq ($(FULL_TARGET),i386-darwin)
override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
endif
ifeq ($(FULL_TARGET),i386-emx)
override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
endif
@ -738,6 +750,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON)
endif
ifeq ($(FULL_TARGET),i386-darwin)
override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON)
endif
ifeq ($(FULL_TARGET),i386-emx)
override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON)
endif
@ -1456,12 +1471,17 @@ endif
endif
export ZIPPROG
ifndef TARPROG
TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
ifeq ($(TARPROG),)
TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
ifeq ($(TARPROG),)
TARPROG= __missing_command_TARPROG
else
TARPROG:=$(firstword $(TARPROG))
endif
else
TARPROG:=$(firstword $(TARPROG))
endif
endif
export TARPROG
ASNAME=$(BINUTILSPREFIX)as

View File

@ -6,7 +6,7 @@
main=rtl
[target]
loaders=wprt0 wdllprt0 gprt0 wcygprt0
loaders=$(LOADERS)
units=system ctypes objpas macpas strings \
lineinfo heaptrc matrix \
windows winsock initc cmem dynlibs signals \
@ -44,11 +44,8 @@ WININC=wininc
UNITPREFIX=rtl
# Use new feature from 1.0.5 version
# that generates release PPU files
# which will not be recompiled
ifdef RELEASE
override FPCOPT+=-Ur
ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
LOADERS=wprt0 wdllprt0 gprt0 wcygprt0
endif
# Paths

View File

@ -93,8 +93,6 @@ var
MainInstance,
cmdshow : longint;
DLLreason,DLLparam:longint;
Win32StackTop : Dword;
type
TDLL_Process_Entry_Hook = function (dllparam : longint) : longbool;
TDLL_Entry_Hook = procedure (dllparam : longint);
@ -365,7 +363,6 @@ procedure remove_exception_handlers;forward;
procedure PascalMain;stdcall;external name 'PASCALMAIN';
procedure fpc_do_exit;stdcall;external name 'FPC_DO_EXIT';
Procedure ExitDLL(Exitcode : longint); forward;
procedure asm_exit(Exitcode : longint);external name 'asm_exit';
Procedure system_exit;
begin
@ -383,7 +380,7 @@ begin
remove_exception_handlers;
{ call exitprocess, with cleanup as required }
asm_exit(exitcode);
ExitProcess(exitcode);
end;
var
@ -391,7 +388,7 @@ var
to check if the call stack can be written on exceptions }
_SS : Cardinal;
procedure Exe_entry;[public, alias : '_FPC_EXE_Entry'];
procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
begin
IsLibrary:=false;
{ install the handlers for exe only ?
@ -412,7 +409,7 @@ procedure Exe_entry;[public, alias : '_FPC_EXE_Entry'];
pushl %ebp
xorl %ebp,%ebp
movl %esp,%eax
movl %eax,Win32StackTop
movl %eax,StackTop
movw %ss,%bp
movl %ebp,_SS
call SysResetFPU
@ -424,6 +421,7 @@ procedure Exe_entry;[public, alias : '_FPC_EXE_Entry'];
system_exit;
end;
Const
{ DllEntryPoint }
DLL_PROCESS_ATTACH = 1;
@ -435,7 +433,7 @@ Var
Const
DLLExitOK : boolean = true;
function Dll_entry : longbool;[public, alias : '_FPC_DLL_Entry'];
function Dll_entry : longbool;
var
res : longbool;
@ -494,6 +492,44 @@ begin
LongJmp(DLLBuf,1);
end;
{$ifndef VER2_0}
procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
begin
IsConsole:=true;
Exe_entry;
end;
procedure _FPC_WinMainCRTStartup;stdcall;public name '_WinMainCRTStartup';
begin
IsConsole:=false;
Exe_entry;
end;
procedure _FPC_DLLMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup@12';
begin
IsConsole:=true;
sysinstance:=_hinstance;
dllreason:=_dllreason;
dllparam:=_dllparam;
DLL_Entry;
end;
procedure _FPC_DLLWinMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup@12';
begin
IsConsole:=false;
sysinstance:=_hinstance;
dllreason:=_dllreason;
dllparam:=_dllparam;
DLL_Entry;
end;
{$endif VER2_0}
function GetCurrentProcess : dword;
stdcall;external 'kernel32' name 'GetCurrentProcess';
@ -1160,13 +1196,15 @@ begin
result := stklen;
end;
{
const
Exe_entry_code : pointer = @Exe_entry;
Dll_entry_code : pointer = @Dll_entry;
}
begin
StackLength := CheckInitialStkLen(InitialStkLen);
StackBottom := initialstkptr - StackLength;
StackBottom := StackTop - StackLength;
{ get some helpful informations }
GetStartupInfo(@startupinfo);
{ some misc Win32 stuff }