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 +4 -4
- data/lib/fiddley.rb +1 -1
- data/lib/fiddley/library.rb +18 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40c44de1a787ff01ff58cbd885e28e4aebffb063
|
4
|
+
data.tar.gz: b2bba367d2214502e68bbb86f4f9ebea98dc52d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b160ea03d9468ac5481b0cf9a19112ceda1bc3f991ffe01b925cc6fae96fdad428b083f6bd32b7452a5e09f2668feaae6bca93c0fb96412cd37248538fea8ac8
|
7
|
+
data.tar.gz: 334b5e0d787047ab6bc0b43390b375769424d663cef00d11d1eaab7822db13dd4c845a65b1e27e3764a6fa2c4e00f0f25778daf3e6302b6dcb2dbcc1e4623116
|
data/lib/fiddley.rb
CHANGED
data/lib/fiddley/library.rb
CHANGED
@@ -6,7 +6,17 @@ module Fiddley
|
|
6
6
|
include Fiddley::Utils
|
7
7
|
include Fiddle::Importer
|
8
8
|
|
9
|
-
|
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
|