Module: FFI::Platform
- Defined in:
- lib/ffi/platform.rb,
ext/ffi_c/Platform.c
Constant Summary collapse
- OS =
case Config::CONFIG['host_os'].downcase when /linux/ "linux" when /darwin/ "darwin" when /freebsd/ "freebsd" when /openbsd/ "openbsd" when /sunos|solaris/ "solaris" when /win|mingw/ "windows" else raise FFI::PlatformError, "Unknown operating system: #{Config::CONFIG['host_os']}" end
- ARCH =
case CPU.downcase when /amd64|x86_64/ "x86_64" when /i?86|x86|i86pc/ "i386" when /ppc|powerpc/ "powerpc" else raise FFI::PlatformError, "Unknown cpu architecture: #{ARCH_}" end
- LIBC =
if IS_WINDOWS "msvcrt" elsif IS_LINUX "libc.so.6" else "c" end
- LIBPREFIX =
IS_WINDOWS ? '' : 'lib'
- LIBSUFFIX =
case OS when /darwin/ 'dylib' when /linux|bsd|solaris/ 'so' when /win/ 'dll' else raise PlatformError, "Cannot determine shared library extension for #{OS}" end
- BYTE_ORDER =
INT2FIX(BYTE_ORDER)
- LITTLE_ENDIAN =
INT2FIX(LITTLE_ENDIAN)
- BIG_ENDIAN =
INT2FIX(BIG_ENDIAN)
- CPU =
rb_str_new2(CPU)
Class Method Summary collapse
Class Method Details
.bsd? ⇒ Boolean
64 65 66 |
# File 'lib/ffi/platform.rb', line 64 def self.bsd? IS_BSD end |
.mac? ⇒ Boolean
70 71 72 |
# File 'lib/ffi/platform.rb', line 70 def self.mac? IS_MAC end |
.unix? ⇒ Boolean
73 74 75 |
# File 'lib/ffi/platform.rb', line 73 def self.unix? !IS_WINDOWS end |
.windows? ⇒ Boolean
67 68 69 |
# File 'lib/ffi/platform.rb', line 67 def self.windows? IS_WINDOWS end |