ffi 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- data/Rakefile +7 -1
- data/ext/ffi_c/Call.h +4 -4
- data/ext/ffi_c/ClosurePool.c +7 -5
- data/ext/ffi_c/MethodHandle.c +1 -1
- data/ext/ffi_c/endian.h +1 -1
- data/ext/ffi_c/extconf.rb +16 -11
- data/ext/ffi_c/libffi.bsd.mk +1 -1
- data/ext/ffi_c/libffi/doc/libffi.info +15 -15
- data/lib/ffi/buffer.rb +4 -0
- data/lib/ffi/ffi.rb +0 -1
- data/lib/ffi/library.rb +1 -1
- data/spec/ffi/managed_struct_spec.rb +1 -1
- data/spec/ffi/pointer_spec.rb +1 -1
- metadata +3 -3
data/Rakefile
CHANGED
@@ -40,10 +40,16 @@ CPU = case Config::CONFIG['host_cpu'].downcase
|
|
40
40
|
else
|
41
41
|
"i386"
|
42
42
|
end
|
43
|
+
|
43
44
|
when /amd64|x86_64/
|
44
45
|
"x86_64"
|
46
|
+
|
47
|
+
when /ppc64|powerpc64/
|
48
|
+
"powerpc64"
|
49
|
+
|
45
50
|
when /ppc|powerpc/
|
46
51
|
"powerpc"
|
52
|
+
|
47
53
|
else
|
48
54
|
Config::CONFIG['host_cpu']
|
49
55
|
end
|
@@ -78,7 +84,7 @@ PROJ.name = 'ffi'
|
|
78
84
|
PROJ.authors = 'Wayne Meissner'
|
79
85
|
PROJ.email = 'wmeissner@gmail.com'
|
80
86
|
PROJ.url = 'http://wiki.github.com/ffi/ffi'
|
81
|
-
PROJ.version = '0.5.
|
87
|
+
PROJ.version = '0.5.3'
|
82
88
|
PROJ.rubyforge.name = 'ffi'
|
83
89
|
PROJ.readme_file = 'README.rdoc'
|
84
90
|
|
data/ext/ffi_c/Call.h
CHANGED
@@ -28,14 +28,14 @@
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
*/
|
30
30
|
|
31
|
-
#ifndef
|
32
|
-
#define
|
31
|
+
#ifndef RBFFI_INVOKE_H
|
32
|
+
#define RBFFI_INVOKE_H
|
33
33
|
|
34
34
|
#ifdef __cplusplus
|
35
35
|
extern "C" {
|
36
36
|
#endif
|
37
37
|
|
38
|
-
#if defined(__i386__) && !defined(_WIN32) && !defined(__WIN32__)
|
38
|
+
#if defined(__i386__) && defined(HAVE_RAW_API) && !defined(_WIN32) && !defined(__WIN32__)
|
39
39
|
# define USE_RAW
|
40
40
|
#endif
|
41
41
|
|
@@ -82,5 +82,5 @@ extern int rbffi_GetSignedIntValue(VALUE value, int type, int minValue, int maxV
|
|
82
82
|
}
|
83
83
|
#endif
|
84
84
|
|
85
|
-
#endif /*
|
85
|
+
#endif /* RBFFI_INVOKE_H */
|
86
86
|
|
data/ext/ffi_c/ClosurePool.c
CHANGED
@@ -35,6 +35,8 @@
|
|
35
35
|
#include <stdbool.h>
|
36
36
|
#ifndef _WIN32
|
37
37
|
# include <unistd.h>
|
38
|
+
#else
|
39
|
+
# include <windows.h>
|
38
40
|
#endif
|
39
41
|
#include <errno.h>
|
40
42
|
#include <ruby.h>
|
@@ -111,7 +113,7 @@ rbffi_ClosurePool_New(int closureSize,
|
|
111
113
|
pool->prep = prep;
|
112
114
|
pool->refcnt = 1;
|
113
115
|
|
114
|
-
#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32)
|
116
|
+
#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32)
|
115
117
|
pthread_mutex_init(&pool->mutex, NULL);
|
116
118
|
#endif
|
117
119
|
|
@@ -253,7 +255,7 @@ rbffi_Closure_CodeAddress(Closure* handle)
|
|
253
255
|
static int
|
254
256
|
getPageSize()
|
255
257
|
{
|
256
|
-
#
|
258
|
+
#if defined(_WIN32) || defined(__WIN32__)
|
257
259
|
SYSTEM_INFO si;
|
258
260
|
GetSystemInfo(&si);
|
259
261
|
return si.dwPageSize;
|
@@ -265,7 +267,7 @@ getPageSize()
|
|
265
267
|
static void*
|
266
268
|
allocatePage(void)
|
267
269
|
{
|
268
|
-
#
|
270
|
+
#if defined(_WIN32) || defined(__WIN32__)
|
269
271
|
return VirtualAlloc(NULL, pageSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
270
272
|
#else
|
271
273
|
caddr_t page = mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
@@ -276,7 +278,7 @@ allocatePage(void)
|
|
276
278
|
static bool
|
277
279
|
freePage(void *addr)
|
278
280
|
{
|
279
|
-
#
|
281
|
+
#if defined(_WIN32) || defined(__WIN32__)
|
280
282
|
return VirtualFree(addr, 0, MEM_RELEASE);
|
281
283
|
#else
|
282
284
|
return munmap(addr, pageSize) == 0;
|
@@ -286,7 +288,7 @@ freePage(void *addr)
|
|
286
288
|
static bool
|
287
289
|
protectPage(void* page)
|
288
290
|
{
|
289
|
-
#
|
291
|
+
#if defined(_WIN32) || defined(__WIN32__)
|
290
292
|
DWORD oldProtect;
|
291
293
|
return VirtualProtect(page, pageSize, PAGE_EXECUTE_READ, &oldProtect);
|
292
294
|
#else
|
data/ext/ffi_c/MethodHandle.c
CHANGED
@@ -175,7 +175,7 @@ attached_method_invoke(ffi_cif* cif, void* mretval, METHOD_PARAMS parameters, vo
|
|
175
175
|
int argc = parameters[0].sint;
|
176
176
|
VALUE* argv = *(VALUE **) ¶meters[1];
|
177
177
|
#else
|
178
|
-
int argc = *(
|
178
|
+
int argc = *(int *) parameters[0];
|
179
179
|
VALUE* argv = *(VALUE **) parameters[1];
|
180
180
|
#endif
|
181
181
|
|
data/ext/ffi_c/endian.h
CHANGED
data/ext/ffi_c/extconf.rb
CHANGED
@@ -3,22 +3,27 @@ require 'mkmf'
|
|
3
3
|
require 'rbconfig'
|
4
4
|
dir_config("ffi_c")
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
unless Config::CONFIG['host_os'] =~ /mswin32|mingw32/
|
7
|
+
pkg_config("libffi") || find_header("ffi.h", "/usr/local/include", "/opt/local/include")
|
8
|
+
have_ffi_call = have_library("ffi", "ffi_call", [ "ffi.h" ])
|
9
|
+
have_prep_closure = have_func("ffi_prep_closure")
|
10
|
+
libffi_ok = have_ffi_call && have_prep_closure
|
11
|
+
$defs << "-DHAVE_LIBFFI" if libffi_ok
|
12
|
+
$defs << "-DHAVE_RAW_API" if have_func("ffi_raw_call") && have_func("ffi_prep_raw_closure")
|
13
|
+
end
|
14
|
+
have_func('rb_thread_blocking_region')
|
15
|
+
|
11
16
|
$defs << "-DHAVE_EXTCONF_H" if $defs.empty? # needed so create_header works
|
12
17
|
|
13
|
-
|
18
|
+
create_header
|
19
|
+
|
20
|
+
$CFLAGS << "-mwin32 " if Config::CONFIG['host_os'] =~ /cygwin/
|
21
|
+
$CFLAGS << "-Werror -Wunused -Wformat -Wimplicit -Wreturn-type "
|
14
22
|
|
15
23
|
create_makefile("ffi_c")
|
16
|
-
|
17
|
-
File.open("Makefile", "a") do |mf|
|
18
|
-
mf.puts "CPPFLAGS += -Werror -Wunused -Wformat -Wimplicit -Wreturn-type"
|
19
|
-
unless libffi_ok
|
24
|
+
unless libffi_ok
|
25
|
+
File.open("Makefile", "a") do |mf|
|
20
26
|
mf.puts "LIBFFI_HOST=--host=#{Config::CONFIG['host_alias']}" if Config::CONFIG.has_key?("host_alias")
|
21
|
-
mf.puts "FFI_MMAP_EXEC=-DFFI_MMAP_EXEC_WRIT=#{Config::CONFIG['host_os'] =~ /(win32|mingw)/ ? 0 : 1}"
|
22
27
|
if Config::CONFIG['host_os'].downcase =~ /darwin/
|
23
28
|
mf.puts "include ${srcdir}/libffi.darwin.mk"
|
24
29
|
elsif Config::CONFIG['host_os'].downcase =~ /bsd/
|
data/ext/ffi_c/libffi.bsd.mk
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
This is /Users/wayne/src/
|
1
|
+
This is /Users/wayne/src/ffi-0.5/ext/ffi_c/libffi/doc/libffi.info,
|
2
2
|
produced by makeinfo version 4.7 from
|
3
|
-
/Users/wayne/src/
|
3
|
+
/Users/wayne/src/ffi-0.5/ext/ffi_c/libffi/doc/libffi.texi.
|
4
4
|
|
5
5
|
This manual is for Libffi, a portable foreign-function interface
|
6
6
|
library.
|
@@ -517,18 +517,18 @@ Index
|
|
517
517
|
|
518
518
|
|
519
519
|
Tag Table:
|
520
|
-
Node: Top
|
521
|
-
Node: Introduction
|
522
|
-
Node: Using libffi
|
523
|
-
Node: The Basics
|
524
|
-
Node: Simple Example
|
525
|
-
Node: Types
|
526
|
-
Node: Primitive Types
|
527
|
-
Node: Structures
|
528
|
-
Node: Type Example
|
529
|
-
Node: Multiple ABIs
|
530
|
-
Node: The Closure API
|
531
|
-
Node: Missing Features
|
532
|
-
Node: Index
|
520
|
+
Node: Top754
|
521
|
+
Node: Introduction1490
|
522
|
+
Node: Using libffi3126
|
523
|
+
Node: The Basics3561
|
524
|
+
Node: Simple Example6168
|
525
|
+
Node: Types7195
|
526
|
+
Node: Primitive Types7478
|
527
|
+
Node: Structures9298
|
528
|
+
Node: Type Example10158
|
529
|
+
Node: Multiple ABIs11381
|
530
|
+
Node: The Closure API11752
|
531
|
+
Node: Missing Features14672
|
532
|
+
Node: Index15165
|
533
533
|
|
534
534
|
End Tag Table
|
data/lib/ffi/buffer.rb
CHANGED
data/lib/ffi/ffi.rb
CHANGED
data/lib/ffi/library.rb
CHANGED
@@ -135,7 +135,7 @@ module FFI::Library
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def callback(*args)
|
138
|
-
raise
|
138
|
+
raise ArgumentError, "wrong number of arguments" if args.length < 2 || args.length > 3
|
139
139
|
name, params, ret = if args.length == 3
|
140
140
|
args
|
141
141
|
else
|
data/spec/ffi/pointer_spec.rb
CHANGED
@@ -107,7 +107,7 @@ end
|
|
107
107
|
|
108
108
|
describe "AutoPointer" do
|
109
109
|
loop_count = 30
|
110
|
-
wiggle_room =
|
110
|
+
wiggle_room = 5 # GC rarely cleans up all objects. we can get most of them, and that's enough to determine if the basic functionality is working.
|
111
111
|
magic = 0x12345678
|
112
112
|
|
113
113
|
class AutoPointerTestHelper
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wayne Meissner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-20 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -390,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
390
|
requirements: []
|
391
391
|
|
392
392
|
rubyforge_project: ffi
|
393
|
-
rubygems_version: 1.3.
|
393
|
+
rubygems_version: 1.3.5
|
394
394
|
signing_key:
|
395
395
|
specification_version: 3
|
396
396
|
summary: Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code
|