mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-19 19:29:32 +02:00
+ InitC unit
This commit is contained in:
parent
4e9c029777
commit
c2b91fcf40
@ -67,7 +67,7 @@ LOADEROBJECTS=wprt0 wdllprt0
|
||||
# Unit Objects
|
||||
UNITOBJECTS=$(SYSTEMUNIT) objpas strings \
|
||||
windows ole2 opengl32 winsock \
|
||||
sockets \
|
||||
sockets initc \
|
||||
dos crt objects \
|
||||
sysutils typinfo math \
|
||||
cpu mmx getopts heaptrc
|
||||
@ -216,6 +216,8 @@ winsock$(PPUEXT) : winsock.pp windows$(PPUEXT) $(SYSTEMPPU)
|
||||
sockets$(PPUEXT) : sockets.pp windows$(PPUEXT) winsock$(PPUEXT) $(SYSTEMPPU) \
|
||||
$(INC)/sockets.inc $(INC)/socketsh.inc
|
||||
|
||||
initc$(PPUEXT) : initc.pp $(SYSTEMPPU)
|
||||
|
||||
#
|
||||
# TP7 Compatible RTL Units
|
||||
#
|
||||
@ -260,7 +262,10 @@ heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
|
||||
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.36 1999-09-16 13:38:07 peter
|
||||
# Revision 1.37 1999-09-28 22:53:27 pierre
|
||||
# + InitC unit
|
||||
#
|
||||
# Revision 1.36 1999/09/16 13:38:07 peter
|
||||
# * windows unit include moved to wininc/
|
||||
#
|
||||
#
|
||||
|
40
rtl/win32/initc.pp
Normal file
40
rtl/win32/initc.pp
Normal file
@ -0,0 +1,40 @@
|
||||
unit initc;
|
||||
|
||||
interface
|
||||
|
||||
{$LINKLIB cygwin}
|
||||
|
||||
{ this unit is just ment to run
|
||||
startup code to get C code to work correctly PM }
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
procedure cygwin_crt0(p : pointer);cdecl;external;
|
||||
|
||||
{
|
||||
procedure do_global_dtors;cdecl;external;
|
||||
this does not work because
|
||||
do_global_dtors is a static C function PM
|
||||
it is inserted into the atexit chain,
|
||||
but how do we call this from FPC ???
|
||||
it seems to be done in exit function
|
||||
but that one ends with _exit that is system dependent !! }
|
||||
|
||||
{ avoid loading of cygwin _exit code
|
||||
so that exit returns }
|
||||
procedure _exit(status : longint);cdecl;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure C_exit(status : longint);popstack;external name '_exit';
|
||||
|
||||
initialization
|
||||
cygwin_crt0(nil);
|
||||
|
||||
finalization
|
||||
{ should we pass exit code ?
|
||||
its apparently only used by _exit so it doesn't matter PM }
|
||||
C_exit(0);
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user