فهرست منبع

* Try to compile with mingw64 gdb

git-svn-id: trunk@16316 -
pierre 14 سال پیش
والد
کامیت
be4daa86e4
1فایلهای تغییر یافته به همراه21 افزوده شده و 9 حذف شده
  1. 21 9
      ide/fpmingw.pas

+ 21 - 9
ide/fpmingw.pas

@@ -18,8 +18,8 @@ interface
 
 
 // mingw put atexit in binaries, so that it can have one atexit, and call it from
 // mingw put atexit in binaries, so that it can have one atexit, and call it from
 // dll and .exe startup code.
 // 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
 Type
   TCFunction = function:longint cdecl; // prototype of an handler to be registered with atexit
   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
 Type
   TAtexitFunction = function(p:TCFUnction):longint cdecl;
   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.
 var _imp__atexit : TAtExitFunction; Cvar; external;  // "true" atexit in mingw libs.
+{$endif not win64}
 
 
 function atexit(p:TCFunction):longint;cdecl; [public, alias : '_atexit'];
 function atexit(p:TCFunction):longint;cdecl; [public, alias : '_atexit'];
 
 
 begin
 begin
+{$ifdef win64}
+  atexit:=__imp_atexit(p);  // simply route to "true" atexit
+{$else not win64}
   atexit:=_imp__atexit(p);  // simply route to "true" atexit
   atexit:=_imp__atexit(p);  // simply route to "true" atexit
-end; 
+{$endif not win64}
+end;
 
 
+{$ifdef win32}
 procedure __cpu_features_init; cdecl; external;
 procedure __cpu_features_init; cdecl; external;
+{$endif win32}
 procedure _pei386_runtime_relocator; cdecl; external;
 procedure _pei386_runtime_relocator; cdecl; external;
 procedure __main; cdecl;external;
 procedure __main; cdecl;external;
 
 
@@ -51,15 +61,17 @@ procedure doinit;
 begin
 begin
  // not (yet) done: set mingw exception handlers:
  // not (yet) done: set mingw exception handlers:
  // SetUnhandledExceptionFilter (_gnu_exception_handler);
  // SetUnhandledExceptionFilter (_gnu_exception_handler);
+{$ifdef win32}
   __cpu_features_init;        // load CPU features. Might be useful for debugger :-)
   __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_mainargs ();  // mingw doesn't handle arguments not necessary.
  //  _mingw32_init_fmode ();     // Set default filemode. Is not done for libraries, so we don't.
  //  _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
  // aligns stack here to 16 bytes
 
 
@@ -69,7 +81,7 @@ begin
       explicitly at app startup rather than rely on gcc to generate
       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
       the call in main's  prologue, since main may be imported from a dll
       which has its own __do_global_ctors.  }
       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;
 end;
 
 
 procedure _cexit; cdecl; external;
 procedure _cexit; cdecl; external;
@@ -79,7 +91,7 @@ begin
 {
 {
    * Perform exit processing for the C library. This means
    * Perform exit processing for the C library. This means
    * flushing output and calling 'atexit' registered functions.
    * flushing output and calling 'atexit' registered functions.
-} 
+}
  _cexit ();
  _cexit ();
 end;
 end;
 
 
@@ -87,4 +99,4 @@ initialization
   doinit;
   doinit;
 finalization
 finalization
   doatexit;
   doatexit;
-end.
+end.