DEADSOFTWARE

it is now possible to link windoze LibJIT and ENet as static libs (see commit comments)
authorKetmar Dark <ketmar@ketmar.no-ip.org>
Sat, 7 Oct 2017 11:45:27 +0000 (14:45 +0300)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Sat, 7 Oct 2017 12:31:57 +0000 (15:31 +0300)
  first, you need to clone http://repo.or.cz/d2df-binlib.git (repo with prebuilt windoze libs)
  then, you can use:
    -dLIBJIT_WINDOZE_STATIC -- static LibJIT
    -dLIBENET_WINDOZE_STATIC -- static ENet
    don't forget to specify lib*.a location with -Fi<...>

  i used mingw-gcc 7.1.0 to build static libs; some other .a libs were taken directly from mingw.
  building is easy: just fire msys, install all dependencies, and do:
    ./configure --enable-static --disable-shared && make
  this should produce working .a library suitable for static linking

README
src/lib/enet/enet.pp
src/lib/libjit/libjit.pas
src/lib/libjit/libjit_opts.inc [new file with mode: 0644]
src/lib/libjit/libjit_types.pas

diff --git a/README b/README
index 69b7baeee6fc8f69d14a4884bf071672e9bf66fc..744360afb9edf41f143da6f98773217f56e45249 100644 (file)
--- a/README
+++ b/README
@@ -24,3 +24,25 @@ Replace -O3 with -g -gl to enable debugging features. Run the game with --gdb wh
 prevent it from eating exceptions.
 
 Windows binaries will require the appropriate DLLs (SDL2.dll, SDL2_mixer.dll or FMODEx.dll, ENet.dll).
+
+
+Static Linking
+--------------
+
+See ( http://repo.or.cz/d2df-binlib.git ) repo for prebuild dynamic and static libraries.
+
+It is now possible to link windoze LibJIT and ENet as static libs.
+
+First, you need to clone ( http://repo.or.cz/d2df-binlib.git ) (repo with prebuilt windoze libs).
+Then, you can use:
+  -dLIBJIT_WINDOZE_STATIC  -- static LibJIT
+  -dLIBENET_WINDOZE_STATIC -- static ENet
+
+Don't forget to specify lib*.a location with -Fi<...>
+
+I (ketmar) used mingw-gcc 7.1.0 to build static libs; some other .a libs were taken directly from mingw.
+building libs is easy: just fire msys, install all dependencies, and do:
+
+  ./configure --enable-static --disable-shared && make
+
+This should produce working .a library suitable for static linking.
index 3ec03704e5405459d6e84a3a92d7dfa5d8ac8995..e50109f641ab696c3bb3128688d20e17ef5c1b13 100644 (file)
@@ -1,9 +1,47 @@
+{.$DEFINE LIBENET_WINDOZE_STATIC}
+
 {$MODE OBJFPC}
 {$PACKRECORDS C}
 
+{$IFDEF WIN32}
+  {$DEFINE MSWINDOWS}
+{$ENDIF}
+
 {$LONGSTRINGS ON}
 {$MACRO ON}
 
+{$Z4} // Force four-byte enums
+
+
+{$IFDEF MSWINDOWS}
+  {$IFDEF LIBENET_WINDOZE_STATIC}
+    {$LINKLIB libenet.a}
+    {$LINKLIB libwinmm.a}
+    {$LINKLIB libws2_32.a}
+    {$LINKLIB libkernel32.a}
+    {$LINKLIB libm.a}
+    {$LINKLIB libmingwex.a}
+    {$LINKLIB libmingw32.a}
+    {$LINKLIB libmsvcrt.a}
+    {$LINKLIB libgcc.a}
+    {$DEFINE libraryLibENetDecl := cdecl}
+    {$DEFINE libraryLibENetImp := cdecl; external}
+    {$DEFINE libraryLibENetVar := cvar; external}
+  {$ELSE}
+    {$DEFINE libraryLibENetDecl := cdecl}
+    {$DEFINE libraryLibENetImp := cdecl; external 'enet.dll'}
+    {.$DEFINE libraryLibENetVar := cvar; external}
+    {$DEFINE libraryLibENetVar := external 'enet.dll'}
+    // external LIBNAME name 'var_name' would've been more correct here
+    // because just external is case insensitive, but fuck it
+  {$ENDIF}
+{$ELSE}
+  {$DEFINE libraryLibENetDecl := cdecl}
+  {$DEFINE libraryLibENetImp := cdecl; external 'enet'}
+  {$DEFINE libraryLibENetVar := cvar; external 'enet'}
+{$ENDIF}
+
+
 unit ENet;
 
 {
@@ -341,8 +379,6 @@ function ENET_TIME_DIFFERENCE( const a, b: cint ): cint; inline;
 // enet.h
 ////////////////////////////////////////////////////////////////////////////////
 
-{$DEFINE libraryENet := cdecl; external 'enet'}
-
 const
   { defines }
   ENET_VERSION_MAJOR = 1;
@@ -596,65 +632,65 @@ function ENET_VERSION_GET_PATCH( const version: ENetVersion ): cint; inline;
 function ENET_VERSION(): ENetVersion; inline;
 
 { library functions }
-function enet_initialize(): cint; libraryENet;
-function enet_initialize_with_callbacks( version: ENetVersion; const inits: pENetCallbacks ): cint; libraryENet;
-procedure enet_deinitialize(); libraryENet;
-function enet_linked_version(): ENetVersion; libraryENet;
-
-function enet_time_get(): enet_uint32; libraryENet;
-procedure enet_time_set( newTimeBase: enet_uint32 ); libraryENet;
-
-function enet_socket_create( kind: ENetSocketType ): ENetSocket; libraryENet;
-function enet_socket_bind( socket: ENetSocket; const address: pENetAddress ): cint; libraryENet;
-function enet_socket_get_address( socket: ENetSocket; address: pENetAddress ): cint; libraryENet;
-function enet_socket_listen( socket: ENetSocket; backlog: cint ): cint; libraryENet;
-function enet_socket_accept( socket: ENetSocket; address: pENetAddress ): ENetSocket; libraryENet;
-function enet_socket_connect( socket: ENetSocket; const address: pENetAddress ): cint; libraryENet;
-function enet_socket_send( socket: ENetSocket; const address: pENetAddress; const buffers: pENetBuffer; bufferCount: csize_t ): cint; libraryENet;
-function enet_socket_receive( socket: ENetSocket; address: pENetAddress; buffers: pENetBuffer; bufferCount: csize_t ): cint; libraryENet;
-function enet_socket_wait( socket: ENetSocket; condition: penet_uint32; timeout: enet_uint32 ): cint; libraryENet;
-function enet_socket_set_option( socket: ENetSocket; option: ENetSocketOption; value: cint ): cint; libraryENet;
-function enet_socket_get_option( socket: ENetSocket; option: ENetSocketOption; value: pcint ): cint; libraryENet;
-function enet_socket_shutdown( socket: ENetSocket; how: ENetSocketShutdown ): cint; libraryENet;
-procedure enet_socket_destroy( socket: ENetSocket ); libraryENet;
-function enet_socketset_select( maxSocket: ENetSocket; readSet: pENetSocketSet; writeSet: pENetSocketSet; timeout: enet_uint32 ): cint; libraryENet;
-
-function enet_address_set_host( address: pENetAddress; const hostName: PChar ): cint; libraryENet;
-function enet_address_get_host_ip( const address: pENetAddress; hostName: PChar; nameLength: csize_t ): cint; libraryENet;
-function enet_address_get_host( const address: pENetAddress; hostName: PChar; nameLength: csize_t ): cint; libraryENet;
-
-function enet_packet_create( const data: Pointer; dataLength: csize_t; flags: enet_uint32 ): pENetPacket; libraryENet;
-procedure enet_packet_destroy( packet: pENetPacket ); libraryENet;
-function enet_packet_resize( packet: pENetPacket; dataLength: csize_t ): cint; libraryENet;
-function enet_crc32( const buffers: pENetBuffer; bufferCount: csize_t ): enet_uint32; libraryENet;
-
-function enet_host_create( const address: pENetAddress; peerCount, channelLimit: csize_t; incomingBandwidth, outgoingBandwidth: enet_uint32 ): pENetHost; libraryENet;
-procedure enet_host_destroy( host: pENetHost ); libraryENet;
-function enet_host_connect( host: pENetHost; const address: pENetAddress; channelCount: csize_t; data: enet_uint32 ): pENetPeer; libraryENet;
-function enet_host_check_events( host: pENetHost; event: pENetEvent ): cint; libraryENet;
-function enet_host_service( host: pENetHost; event: pENetEvent; timeout: enet_uint32 ): cint; libraryENet;
-procedure enet_host_flush( host: pENetHost ); libraryENet;
-procedure enet_host_broadcast( host: pENetHost; channelID: enet_uint8; packet: pENetPacket ); libraryENet;
-procedure enet_host_compress( host: pENetHost; const compressor: pENetCompressor ); libraryENet;
-function enet_host_compress_with_range_coder( host: pENetHost ): cint; libraryENet;
-procedure enet_host_channel_limit( host: pENetHost; channelLimit: csize_t ); libraryENet;
-procedure enet_host_bandwidth_limit( host: pENetHost; incomingBandwidth, outgoingBandwidth: enet_uint32 ); libraryENet;
-
-function enet_peer_send( peer: pENetPeer; channelID: enet_uint8; packet: pENetPacket ): cint; libraryENet;
-function enet_peer_receive( peer: pENetPeer; channelID: penet_uint8 ): pENetPacket; libraryENet;
-procedure enet_peer_ping( peer: pENetPeer ); libraryENet;
-procedure enet_peer_ping_interval( peer: pENetPeer; pingInterval: enet_uint32 ); libraryENet;
-procedure enet_peer_timeout( peer: pENetPeer; timeoutLimit, timeoutMinimum, timeoutMaximum: enet_uint32 ); libraryENet;
-procedure enet_peer_reset( peer: pENetPeer ); libraryENet;
-procedure enet_peer_disconnect( peer: pENetPeer; data: enet_uint32 ); libraryENet;
-procedure enet_peer_disconnect_now( peer: pENetPeer; data: enet_uint32 ); libraryENet;
-procedure enet_peer_disconnect_later( peer: pENetPeer; data: enet_uint32 ); libraryENet;
-procedure enet_peer_throttle_configure( peer: pENetPeer; interval, acceleration, deceleration: enet_uint32 ); libraryENet;
-
-function enet_range_coder_create(): Pointer; libraryENet;
-procedure enet_range_coder_destroy( context: Pointer ); libraryENet;
-function enet_range_coder_compress( context: Pointer; const inBuffers: pENetBuffer; inBufferCount, inLiit: csize_t; outData: penet_uint8; outLimit: csize_t ): csize_t; libraryENet;
-function enet_range_coder_decompress( context: Pointer; const inData: penet_uint8; inLimit: csize_t; outData: penet_uint8; outLimit: csize_t ): csize_t; libraryENet;
+function enet_initialize(): cint; libraryLibENetImp;
+function enet_initialize_with_callbacks( version: ENetVersion; const inits: pENetCallbacks ): cint; libraryLibENetImp;
+procedure enet_deinitialize(); libraryLibENetImp;
+function enet_linked_version(): ENetVersion; libraryLibENetImp;
+
+function enet_time_get(): enet_uint32; libraryLibENetImp;
+procedure enet_time_set( newTimeBase: enet_uint32 ); libraryLibENetImp;
+
+function enet_socket_create( kind: ENetSocketType ): ENetSocket; libraryLibENetImp;
+function enet_socket_bind( socket: ENetSocket; const address: pENetAddress ): cint; libraryLibENetImp;
+function enet_socket_get_address( socket: ENetSocket; address: pENetAddress ): cint; libraryLibENetImp;
+function enet_socket_listen( socket: ENetSocket; backlog: cint ): cint; libraryLibENetImp;
+function enet_socket_accept( socket: ENetSocket; address: pENetAddress ): ENetSocket; libraryLibENetImp;
+function enet_socket_connect( socket: ENetSocket; const address: pENetAddress ): cint; libraryLibENetImp;
+function enet_socket_send( socket: ENetSocket; const address: pENetAddress; const buffers: pENetBuffer; bufferCount: csize_t ): cint; libraryLibENetImp;
+function enet_socket_receive( socket: ENetSocket; address: pENetAddress; buffers: pENetBuffer; bufferCount: csize_t ): cint; libraryLibENetImp;
+function enet_socket_wait( socket: ENetSocket; condition: penet_uint32; timeout: enet_uint32 ): cint; libraryLibENetImp;
+function enet_socket_set_option( socket: ENetSocket; option: ENetSocketOption; value: cint ): cint; libraryLibENetImp;
+function enet_socket_get_option( socket: ENetSocket; option: ENetSocketOption; value: pcint ): cint; libraryLibENetImp;
+function enet_socket_shutdown( socket: ENetSocket; how: ENetSocketShutdown ): cint; libraryLibENetImp;
+procedure enet_socket_destroy( socket: ENetSocket ); libraryLibENetImp;
+function enet_socketset_select( maxSocket: ENetSocket; readSet: pENetSocketSet; writeSet: pENetSocketSet; timeout: enet_uint32 ): cint; libraryLibENetImp;
+
+function enet_address_set_host( address: pENetAddress; const hostName: PChar ): cint; libraryLibENetImp;
+function enet_address_get_host_ip( const address: pENetAddress; hostName: PChar; nameLength: csize_t ): cint; libraryLibENetImp;
+function enet_address_get_host( const address: pENetAddress; hostName: PChar; nameLength: csize_t ): cint; libraryLibENetImp;
+
+function enet_packet_create( const data: Pointer; dataLength: csize_t; flags: enet_uint32 ): pENetPacket; libraryLibENetImp;
+procedure enet_packet_destroy( packet: pENetPacket ); libraryLibENetImp;
+function enet_packet_resize( packet: pENetPacket; dataLength: csize_t ): cint; libraryLibENetImp;
+function enet_crc32( const buffers: pENetBuffer; bufferCount: csize_t ): enet_uint32; libraryLibENetImp;
+
+function enet_host_create( const address: pENetAddress; peerCount, channelLimit: csize_t; incomingBandwidth, outgoingBandwidth: enet_uint32 ): pENetHost; libraryLibENetImp;
+procedure enet_host_destroy( host: pENetHost ); libraryLibENetImp;
+function enet_host_connect( host: pENetHost; const address: pENetAddress; channelCount: csize_t; data: enet_uint32 ): pENetPeer; libraryLibENetImp;
+function enet_host_check_events( host: pENetHost; event: pENetEvent ): cint; libraryLibENetImp;
+function enet_host_service( host: pENetHost; event: pENetEvent; timeout: enet_uint32 ): cint; libraryLibENetImp;
+procedure enet_host_flush( host: pENetHost ); libraryLibENetImp;
+procedure enet_host_broadcast( host: pENetHost; channelID: enet_uint8; packet: pENetPacket ); libraryLibENetImp;
+procedure enet_host_compress( host: pENetHost; const compressor: pENetCompressor ); libraryLibENetImp;
+function enet_host_compress_with_range_coder( host: pENetHost ): cint; libraryLibENetImp;
+procedure enet_host_channel_limit( host: pENetHost; channelLimit: csize_t ); libraryLibENetImp;
+procedure enet_host_bandwidth_limit( host: pENetHost; incomingBandwidth, outgoingBandwidth: enet_uint32 ); libraryLibENetImp;
+
+function enet_peer_send( peer: pENetPeer; channelID: enet_uint8; packet: pENetPacket ): cint; libraryLibENetImp;
+function enet_peer_receive( peer: pENetPeer; channelID: penet_uint8 ): pENetPacket; libraryLibENetImp;
+procedure enet_peer_ping( peer: pENetPeer ); libraryLibENetImp;
+procedure enet_peer_ping_interval( peer: pENetPeer; pingInterval: enet_uint32 ); libraryLibENetImp;
+procedure enet_peer_timeout( peer: pENetPeer; timeoutLimit, timeoutMinimum, timeoutMaximum: enet_uint32 ); libraryLibENetImp;
+procedure enet_peer_reset( peer: pENetPeer ); libraryLibENetImp;
+procedure enet_peer_disconnect( peer: pENetPeer; data: enet_uint32 ); libraryLibENetImp;
+procedure enet_peer_disconnect_now( peer: pENetPeer; data: enet_uint32 ); libraryLibENetImp;
+procedure enet_peer_disconnect_later( peer: pENetPeer; data: enet_uint32 ); libraryLibENetImp;
+procedure enet_peer_throttle_configure( peer: pENetPeer; interval, acceleration, deceleration: enet_uint32 ); libraryLibENetImp;
+
+function enet_range_coder_create(): Pointer; libraryLibENetImp;
+procedure enet_range_coder_destroy( context: Pointer ); libraryLibENetImp;
+function enet_range_coder_compress( context: Pointer; const inBuffers: pENetBuffer; inBufferCount, inLiit: csize_t; outData: penet_uint8; outLimit: csize_t ): csize_t; libraryLibENetImp;
+function enet_range_coder_decompress( context: Pointer; const inData: penet_uint8; inLimit: csize_t; outData: penet_uint8; outLimit: csize_t ): csize_t; libraryLibENetImp;
 
 implementation
 
index 1310c8ea30c8a0c8fdb07ade7d9954c9fd7e64e8..512702ee110c51a211fd0fc5476e113c96e3f661 100644 (file)
  * License along with the libjit library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *)
-unit libjit;
-
-{$IFDEF WIN32}
-  {$DEFINE MSWINDOWS}
-{$ENDIF}
-
 {$MODE DELPHI}
-{$PACKRECORDS C}
-{$MACRO ON}
-
-{$Z4} // Force four-byte enums
+{$INCLUDE libjit_opts.inc}
+unit libjit;
 
 interface
 
-const
-  {$IFDEF MSWINDOWS}
-    //{$LINKLIB libjit.dll.a}
-    LIBJIT_LIBNAME = 'libjit-0.dll';
-    {$DEFINE libraryLibJITDecl := cdecl}
-    {$DEFINE libraryLibJITImp := cdecl; external LIBJIT_LIBNAME}
-  {$ELSE}
-    LIBJIT_LIBNAME = 'jit';
-    {$DEFINE libraryLibJITDecl := cdecl}
-    {$DEFINE libraryLibJITImp := cdecl; external LIBJIT_LIBNAME}
-  {$ENDIF}
-
-
 type
   jit_sbyte = ShortInt; pjit_sbyte = ^jit_sbyte;
   jit_ubyte = Byte; pjit_ubyte = ^jit_ubyte;
@@ -2175,6 +2154,7 @@ Pointer _jit_get_return_address(Pointer frame; Pointer frame0; Pointer return0);
 
 implementation
 
+
 function jit_context_create; libraryLibJITImp;
 procedure jit_context_destroy; libraryLibJITImp;
 procedure jit_context_build_start; libraryLibJITImp;
diff --git a/src/lib/libjit/libjit_opts.inc b/src/lib/libjit/libjit_opts.inc
new file mode 100644 (file)
index 0000000..f3c9ef3
--- /dev/null
@@ -0,0 +1,38 @@
+{.$DEFINE LIBJIT_WINDOZE_STATIC}
+
+{$IFDEF WIN32}
+  {$DEFINE MSWINDOWS}
+{$ENDIF}
+
+{.$MODE OBJFPC}
+{$PACKRECORDS C}
+{$MACRO ON}
+
+{$Z4} // Force four-byte enums
+
+
+{$IFDEF MSWINDOWS}
+  {$IFDEF LIBJIT_WINDOZE_STATIC}
+    {$LINKLIB libjit.a}
+    {$LINKLIB libkernel32.a}
+    {$LINKLIB libm.a}
+    {$LINKLIB libmingwex.a}
+    {$LINKLIB libmingw32.a}
+    {$LINKLIB libmsvcrt.a}
+    {$LINKLIB libgcc.a}
+    {$DEFINE libraryLibJITDecl := cdecl}
+    {$DEFINE libraryLibJITImp := cdecl; external}
+    {$DEFINE libraryLibJITVar := cvar; external}
+  {$ELSE}
+    {$DEFINE libraryLibJITDecl := cdecl}
+    {$DEFINE libraryLibJITImp := cdecl; external 'libjit-0.dll'}
+    {.$DEFINE libraryLibJITVar := cvar; external}
+    {$DEFINE libraryLibJITVar := external 'libjit-0.dll'}
+    // external LIBNAME name 'var_name' would've been more correct here
+    // because just external is case insensitive, but fuck it
+  {$ENDIF}
+{$ELSE}
+  {$DEFINE libraryLibJITDecl := cdecl}
+  {$DEFINE libraryLibJITImp := cdecl; external 'jit'}
+  {$DEFINE libraryLibJITVar := cvar; external 'jit'}
+{$ENDIF}
index 6791939b264bf4f872cbfe527daa7af3c98200d9..8f93162f4fa97e896c23aa20f241cecf4a1ad83b 100644 (file)
  * License along with the libjit library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *)
-unit libjit_types;
-
-{$IFDEF WIN32}
-  {$DEFINE MSWINDOWS}
-{$ENDIF}
-
 {$MODE OBJFPC}
-{$PACKRECORDS C}
-{$MACRO ON}
-
-{$Z4} // Force four-byte enums
+{$INCLUDE libjit_opts.inc}
+unit libjit_types;
 
 interface
 
 uses
   libjit;
 
-//LIBJIT_LIBNAME = 'libjit.dll';
-{$IF not DEFINED(MSWINDOWS)}
-(*const*) var jit_opcodes: packed array [0..JIT_OP_NUM_OPCODES-1] of jit_opcode_info_t; cvar; external LIBJIT_LIBNAME;
-
-(*
- * Pre-defined type descriptors.
- *)
-(*const*) var jit_type_void: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sbyte: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_ubyte: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_short: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_ushort: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_int: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_uint: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_nint: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_nuint: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_long: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_ulong: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_float32: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_float64: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_nfloat: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_void_ptr: jit_type_t; cvar; external LIBJIT_LIBNAME;
-
-(*
- * Type descriptors for the system "char", "int", "long", etc types.
- * These are defined to one of the above values.
- *)
-(*const*) var jit_type_sys_bool: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_char: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_schar: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_uchar: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_short: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_ushort: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_int: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_uint: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_long: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_ulong: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_longlong: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_ulonglong: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_float: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_double: jit_type_t; cvar; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_long_double: jit_type_t; cvar; external LIBJIT_LIBNAME;
-
-{$ELSE}
-
-{ external LIBNAME name 'var_name' would've been more correct here }
-{ because just external is case insensitive, but fuck it           }
-
-(*const*) var jit_opcodes: packed array [0..JIT_OP_NUM_OPCODES-1] of jit_opcode_info_t; external LIBJIT_LIBNAME;
+(*const*) var jit_opcodes: packed array [0..JIT_OP_NUM_OPCODES-1] of jit_opcode_info_t; libraryLibJITVar;
 
 (*
  * Pre-defined type descriptors.
  *)
-(*const*) var jit_type_void: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sbyte: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_ubyte: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_short: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_ushort: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_int: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_uint: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_nint: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_nuint: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_long: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_ulong: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_float32: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_float64: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_nfloat: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_void_ptr: jit_type_t; external LIBJIT_LIBNAME;
+(*const*) var jit_type_void: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sbyte: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_ubyte: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_short: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_ushort: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_int: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_uint: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_nint: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_nuint: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_long: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_ulong: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_float32: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_float64: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_nfloat: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_void_ptr: jit_type_t; libraryLibJITVar;
 
 (*
  * Type descriptors for the system "char", "int", "long", etc types.
  * These are defined to one of the above values.
  *)
-(*const*) var jit_type_sys_bool: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_char: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_schar: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_uchar: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_short: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_ushort: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_int: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_uint: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_long: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_ulong: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_longlong: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_ulonglong: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_float: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_double: jit_type_t; external LIBJIT_LIBNAME;
-(*const*) var jit_type_sys_long_double: jit_type_t; external LIBJIT_LIBNAME;
-
-{$ENDIF}
+(*const*) var jit_type_sys_bool: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_char: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_schar: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_uchar: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_short: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_ushort: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_int: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_uint: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_long: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_ulong: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_longlong: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_ulonglong: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_float: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_double: jit_type_t; libraryLibJITVar;
+(*const*) var jit_type_sys_long_double: jit_type_t; libraryLibJITVar;
 
 
 implementation