mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-08 05:19:14 +02:00
* Try to compile with mingw64 gdb
git-svn-id: trunk@16316 -
This commit is contained in:
parent
9f46b931e2
commit
be4daa86e4
@ -18,8 +18,8 @@ interface
|
||||
|
||||
// mingw put atexit in binaries, so that it can have one atexit, and call it from
|
||||
// dll and .exe startup code.
|
||||
// This unit provides a similar service for when mingw code (read: libgdb and friends) are statically
|
||||
// linked to FPC.
|
||||
// This unit provides a similar service for when mingw code (read: libgdb and friends) are statically
|
||||
// linked to FPC.
|
||||
|
||||
Type
|
||||
TCFunction = function:longint cdecl; // prototype of an handler to be registered with atexit
|
||||
@ -34,15 +34,25 @@ uses gdbint; // force dependancies that hopefully make it execute at the right m
|
||||
Type
|
||||
TAtexitFunction = function(p:TCFUnction):longint cdecl;
|
||||
|
||||
{$ifdef win64}
|
||||
var __imp_atexit : TAtExitFunction; Cvar; external; // "true" atexit in mingw libs.
|
||||
{$else not win64}
|
||||
var _imp__atexit : TAtExitFunction; Cvar; external; // "true" atexit in mingw libs.
|
||||
{$endif not win64}
|
||||
|
||||
function atexit(p:TCFunction):longint;cdecl; [public, alias : '_atexit'];
|
||||
|
||||
begin
|
||||
{$ifdef win64}
|
||||
atexit:=__imp_atexit(p); // simply route to "true" atexit
|
||||
{$else not win64}
|
||||
atexit:=_imp__atexit(p); // simply route to "true" atexit
|
||||
end;
|
||||
{$endif not win64}
|
||||
end;
|
||||
|
||||
{$ifdef win32}
|
||||
procedure __cpu_features_init; cdecl; external;
|
||||
{$endif win32}
|
||||
procedure _pei386_runtime_relocator; cdecl; external;
|
||||
procedure __main; cdecl;external;
|
||||
|
||||
@ -51,15 +61,17 @@ procedure doinit;
|
||||
begin
|
||||
// not (yet) done: set mingw exception handlers:
|
||||
// SetUnhandledExceptionFilter (_gnu_exception_handler);
|
||||
{$ifdef win32}
|
||||
__cpu_features_init; // load CPU features. Might be useful for debugger :-)
|
||||
{$endif win32}
|
||||
|
||||
// fpreset; // don't do this, we init our own fp mask
|
||||
// fpreset; // don't do this, we init our own fp mask
|
||||
|
||||
// _mingw32_init_mainargs (); // mingw doesn't handle arguments not necessary.
|
||||
// _mingw32_init_fmode (); // Set default filemode. Is not done for libraries, so we don't.
|
||||
|
||||
// Adust references to dllimported data that have non-zero offsets.
|
||||
_pei386_runtime_relocator; //
|
||||
// Adust references to dllimported data that have non-zero offsets.
|
||||
_pei386_runtime_relocator; //
|
||||
|
||||
// aligns stack here to 16 bytes
|
||||
|
||||
@ -69,7 +81,7 @@ begin
|
||||
explicitly at app startup rather than rely on gcc to generate
|
||||
the call in main's prologue, since main may be imported from a dll
|
||||
which has its own __do_global_ctors. }
|
||||
// __main; // should be libgcc initialization but this causes infinite loop.
|
||||
// __main; // should be libgcc initialization but this causes infinite loop.
|
||||
end;
|
||||
|
||||
procedure _cexit; cdecl; external;
|
||||
@ -79,7 +91,7 @@ begin
|
||||
{
|
||||
* Perform exit processing for the C library. This means
|
||||
* flushing output and calling 'atexit' registered functions.
|
||||
}
|
||||
}
|
||||
_cexit ();
|
||||
end;
|
||||
|
||||
@ -87,4 +99,4 @@ initialization
|
||||
doinit;
|
||||
finalization
|
||||
doatexit;
|
||||
end.
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user