fiddley 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff58c14e7eed618a4c40f23d0b962f6e4d4aac51
4
- data.tar.gz: 84ce3629b10e1cd0d6f068f60d4c9c6891b5d0f8
3
+ metadata.gz: 40c44de1a787ff01ff58cbd885e28e4aebffb063
4
+ data.tar.gz: b2bba367d2214502e68bbb86f4f9ebea98dc52d6
5
5
  SHA512:
6
- metadata.gz: 96a3282bf572735f15aeff0a21a472f50da36df876bcce23e8d3a1785fa8d8c06ba1be2b4eaceaa6984a4bb89968a9f9c8435fc4888266b5052964c02664a7e0
7
- data.tar.gz: 2b9cae8442c68515937c62c0697604f9ad2b249fce6f3b4fa09aa38f9cf90499baf07fe1c433f699b3ef021ff58760b82a539e154772a7db2d4cb4b5dce54325
6
+ metadata.gz: b160ea03d9468ac5481b0cf9a19112ceda1bc3f991ffe01b925cc6fae96fdad428b083f6bd32b7452a5e09f2668feaae6bca93c0fb96412cd37248538fea8ac8
7
+ data.tar.gz: 334b5e0d787047ab6bc0b43390b375769424d663cef00d11d1eaab7822db13dd4c845a65b1e27e3764a6fa2c4e00f0f25778daf3e6302b6dcb2dbcc1e4623116
@@ -1,5 +1,5 @@
1
1
  module Fiddley
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
4
4
 
5
5
  require "fiddley/function"
@@ -6,7 +6,17 @@ module Fiddley
6
6
  include Fiddley::Utils
7
7
  include Fiddle::Importer
8
8
 
9
- alias ffi_lib dlload
9
+ def ffi_lib(so)
10
+ begin
11
+ dlload so
12
+ rescue Fiddle::DLError
13
+ begin
14
+ dlload LIBPREFIX + so
15
+ rescue Fiddle::DLError
16
+ dlload LIBPREFIX + so + "." + LIBSUFFIX
17
+ end
18
+ end
19
+ end
10
20
 
11
21
  def extended(mod)
12
22
  @convention = nil
@@ -41,6 +51,8 @@ module Fiddley
41
51
 
42
52
  case RUBY_PLATFORM
43
53
  when /cygwin/
54
+ libprefix = "cyg"
55
+ libsuffix = "dll"
44
56
  libc_so = "cygwin1.dll"
45
57
  libm_so = "cygwin1.dll"
46
58
  when /linux/
@@ -56,10 +68,13 @@ module Fiddley
56
68
  libc_so = File.join(libdir, "libc.so.6")
57
69
  libm_so = File.join(libdir, "libm.so.6")
58
70
  when /mingw/, /mswin/
71
+ libprefix = ""
72
+ libsuffix = "dll"
59
73
  require "rbconfig"
60
74
  crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'
61
75
  libc_so = libm_so = "#{crtname}.dll"
62
76
  when /darwin/
77
+ libsuffix = "dylib"
63
78
  libc_so = "/usr/lib/libc.dylib"
64
79
  libm_so = "/usr/lib/libm.dylib"
65
80
  when /kfreebsd/
@@ -101,6 +116,8 @@ module Fiddley
101
116
  libm_so = $& if !libm_so && %r{/\S*/libm\.so\S*} =~ ldd
102
117
  end
103
118
 
119
+ LIBPREFIX = libprefix || "lib"
120
+ LIBSUFFIX = libsuffix || "so"
104
121
  LIBC = libc_so
105
122
  LIBM = libm_so
106
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiddley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - U.Nakamura