From 9aa48684216b0dca926fa7e68a1b843dc1a872ce Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 8 May 2008 17:57:26 +0000 Subject: - added the {$H+} switch for FPC (was introduced for the MacOSX before). This will use AnsiString (no length restriction and passed as pointer) instead of ShortString (= array[0..255] of Char). This is the standard in Delphi so we should use it in FPC too. The FPC reference doc states that {$H-} is standard in FPC, but for any reason in my FPC 2.2.0 for win {$H+} is standard. Maybe the reference guide is somewhat outdated, so probably nothing changed because H+ was the default already. - removed DLL_CDECL from switches.inc and put it directly into the headers (used in bass and freeimage). Libs shouldn't be declared STDCALL or CDECL globally because it depends on how the libs are compiled. For windows, STDCALL and CDECL are possible, so please define this on a per library base. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1069 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/FreeImage/FreeBitmap.pas | 8 +++++--- Game/Code/lib/FreeImage/FreeImage.pas | 22 +++++++++++++++++++++- Game/Code/lib/bass/MacOSX/Bass.pas | 4 ++++ Game/Code/lib/fft/UFFT.pas | 3 +-- Game/Code/lib/midi/CIRCBUF.PAS | 5 +++++ Game/Code/lib/midi/DELPHMCB.PAS | 5 +++++ Game/Code/lib/midi/MIDIDEFS.PAS | 5 +++++ Game/Code/lib/midi/MIDITYPE.PAS | 5 +++++ Game/Code/lib/midi/MidiFile.pas | 1 + Game/Code/lib/midi/MidiScope.pas | 5 +++++ Game/Code/lib/midi/Midicons.pas | 5 +++++ Game/Code/lib/midi/Midiin.pas | 1 + Game/Code/lib/midi/Midiout.pas | 1 + Game/Code/lib/other/DirWatch.pas | 1 + Game/Code/lib/projectM/projectM.pas | 1 + Game/Code/lib/zlib/zlib.pas | 1 + 16 files changed, 67 insertions(+), 6 deletions(-) (limited to 'Game/Code/lib') diff --git a/Game/Code/lib/FreeImage/FreeBitmap.pas b/Game/Code/lib/FreeImage/FreeBitmap.pas index 47be822e..26a7f243 100755 --- a/Game/Code/lib/FreeImage/FreeBitmap.pas +++ b/Game/Code/lib/FreeImage/FreeBitmap.pas @@ -1,8 +1,5 @@ unit FreeBitmap; -{$I switches.inc} - - // ========================================================== // // Delphi wrapper for FreeImage 3 @@ -34,6 +31,11 @@ unit FreeBitmap; // // ========================================================== +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + interface uses diff --git a/Game/Code/lib/FreeImage/FreeImage.pas b/Game/Code/lib/FreeImage/FreeImage.pas index a1c0e7de..c33d1bc8 100755 --- a/Game/Code/lib/FreeImage/FreeImage.pas +++ b/Game/Code/lib/FreeImage/FreeImage.pas @@ -32,10 +32,30 @@ interface uses Windows; -{$MINENUMSIZE 4} // Make sure enums are stored as an integer to be compatible with C/C++ +{$IFDEF FPC} + {$MODE DELPHI} + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) +{$ENDIF} + +{$IFDEF MSWINDOWS} + {$DEFINE DLL_STDCALL} +{$ELSE} + {$DEFINE DLL_CDECL} +{$ENDIF} const +{$IFDEF MSWINDOWS} + FIDLL = 'freeimage.dll'; +{$ENDIF} +{$IFDEF LINUX} + FIDLL = 'libfreeimage.so'; +{$ENDIF} +{$IFDEF DARWIN} FIDLL = 'libfreeimage.dylib'; +{$ENDIF} // -------------------------------------------------------------------------- // Bitmap types ------------------------------------------------------------- diff --git a/Game/Code/lib/bass/MacOSX/Bass.pas b/Game/Code/lib/bass/MacOSX/Bass.pas index d065f027..284004d3 100755 --- a/Game/Code/lib/bass/MacOSX/Bass.pas +++ b/Game/Code/lib/bass/MacOSX/Bass.pas @@ -13,6 +13,10 @@ unit Bass; {$I switches.inc} +{$IFDEF DARWIN} + {$DEFINE DLL_CDECL} +{$ENDIF} + interface uses diff --git a/Game/Code/lib/fft/UFFT.pas b/Game/Code/lib/fft/UFFT.pas index e0f03630..87c981e0 100644 --- a/Game/Code/lib/fft/UFFT.pas +++ b/Game/Code/lib/fft/UFFT.pas @@ -47,10 +47,9 @@ unit UFFT; {$IFDEF FPC} {$MODE Delphi} + {$H+} // Use AnsiString {$ENDIF} -{$I switches.inc} - interface type TSingleArray = array[0..0] of Single; diff --git a/Game/Code/lib/midi/CIRCBUF.PAS b/Game/Code/lib/midi/CIRCBUF.PAS index 9f1f8390..c741230e 100644 --- a/Game/Code/lib/midi/CIRCBUF.PAS +++ b/Game/Code/lib/midi/CIRCBUF.PAS @@ -21,6 +21,11 @@ Unit Circbuf; interface +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + Uses Windows, MMSystem; diff --git a/Game/Code/lib/midi/DELPHMCB.PAS b/Game/Code/lib/midi/DELPHMCB.PAS index e8b732fa..5d4ad75a 100644 --- a/Game/Code/lib/midi/DELPHMCB.PAS +++ b/Game/Code/lib/midi/DELPHMCB.PAS @@ -9,6 +9,11 @@ unit Delphmcb; interface +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + uses Windows, MMsystem, diff --git a/Game/Code/lib/midi/MIDIDEFS.PAS b/Game/Code/lib/midi/MIDIDEFS.PAS index 8e351a07..e97a8627 100644 --- a/Game/Code/lib/midi/MIDIDEFS.PAS +++ b/Game/Code/lib/midi/MIDIDEFS.PAS @@ -11,6 +11,11 @@ unit Mididefs; interface +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + uses Windows, MMsystem, diff --git a/Game/Code/lib/midi/MIDITYPE.PAS b/Game/Code/lib/midi/MIDITYPE.PAS index 18d05ec4..a4166c42 100644 --- a/Game/Code/lib/midi/MIDITYPE.PAS +++ b/Game/Code/lib/midi/MIDITYPE.PAS @@ -8,6 +8,11 @@ unit Miditype; interface +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + uses Classes, Windows, diff --git a/Game/Code/lib/midi/MidiFile.pas b/Game/Code/lib/midi/MidiFile.pas index 0c150a8b..2da052f4 100644 --- a/Game/Code/lib/midi/MidiFile.pas +++ b/Game/Code/lib/midi/MidiFile.pas @@ -92,6 +92,7 @@ interface {$IFDEF FPC} {$MODE Delphi} + {$H+} // use AnsiString {$ENDIF} uses diff --git a/Game/Code/lib/midi/MidiScope.pas b/Game/Code/lib/midi/MidiScope.pas index 0caa430f..43efc4e8 100644 --- a/Game/Code/lib/midi/MidiScope.pas +++ b/Game/Code/lib/midi/MidiScope.pas @@ -18,6 +18,11 @@ unit MidiScope; interface +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; diff --git a/Game/Code/lib/midi/Midicons.pas b/Game/Code/lib/midi/Midicons.pas index 41dda9e1..45bae463 100644 --- a/Game/Code/lib/midi/Midicons.pas +++ b/Game/Code/lib/midi/Midicons.pas @@ -9,6 +9,11 @@ unit Midicons; interface +{$IFDEF FPC} + {$MODE Delphi} + {$H+} // use AnsiString +{$ENDIF} + uses Messages; const diff --git a/Game/Code/lib/midi/Midiin.pas b/Game/Code/lib/midi/Midiin.pas index 8cb7beb7..a122bcb0 100644 --- a/Game/Code/lib/midi/Midiin.pas +++ b/Game/Code/lib/midi/Midiin.pas @@ -103,6 +103,7 @@ interface {$IFDEF FPC} {$MODE Delphi} + {$H+} // use AnsiString {$ENDIF} uses diff --git a/Game/Code/lib/midi/Midiout.pas b/Game/Code/lib/midi/Midiout.pas index cdbc762d..81b00e9f 100644 --- a/Game/Code/lib/midi/Midiout.pas +++ b/Game/Code/lib/midi/Midiout.pas @@ -98,6 +98,7 @@ interface {$IFDEF FPC} {$MODE Delphi} + {$H+} // use AnsiString {$ENDIF} uses diff --git a/Game/Code/lib/other/DirWatch.pas b/Game/Code/lib/other/DirWatch.pas index 95e0f8e9..adeb34ed 100644 --- a/Game/Code/lib/other/DirWatch.pas +++ b/Game/Code/lib/other/DirWatch.pas @@ -25,6 +25,7 @@ interface {$IFDEF FPC} {$MODE Delphi} + {$H+} // use AnsiString {$ENDIF} uses diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas index 0eec9638..26c2588d 100644 --- a/Game/Code/lib/projectM/projectM.pas +++ b/Game/Code/lib/projectM/projectM.pas @@ -2,6 +2,7 @@ unit projectM; {$IFDEF FPC} {$MODE DELPHI} + {$H+} (* use AnsiString *) {$PACKENUM 4} (* use 4-byte enums *) {$PACKRECORDS C} (* C/C++-compatible record packing *) {$ELSE} diff --git a/Game/Code/lib/zlib/zlib.pas b/Game/Code/lib/zlib/zlib.pas index 8c8362ba..9019d23b 100644 --- a/Game/Code/lib/zlib/zlib.pas +++ b/Game/Code/lib/zlib/zlib.pas @@ -14,6 +14,7 @@ interface {$ifdef FPC} {$mode objfpc} // Needed for array of const + {$H+} // use AnsiString {$PACKRECORDS C} {$endif} -- cgit v1.2.3