ffi 1.14.2 → 1.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -0
- data/Gemfile +1 -4
- data/README.md +4 -0
- data/Rakefile +16 -23
- data/ext/ffi_c/Call.c +0 -1
- data/ext/ffi_c/Function.c +23 -3
- data/ext/ffi_c/Function.h +0 -4
- data/ext/ffi_c/MemoryPointer.h +0 -4
- data/ext/ffi_c/Platform.c +2 -2
- data/ext/ffi_c/Pointer.h +0 -4
- data/ext/ffi_c/StructLayout.c +0 -1
- data/ext/ffi_c/Types.c +6 -7
- data/ext/ffi_c/Types.h +3 -4
- data/ext/ffi_c/Variadic.c +12 -2
- data/ext/ffi_c/extconf.rb +5 -2
- data/ext/ffi_c/libffi/Makefile.in +4 -2
- data/ext/ffi_c/libffi/configure +12 -20
- data/ext/ffi_c/libffi/doc/Makefile.in +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +1 -1
- data/ext/ffi_c/libffi/install-sh +80 -68
- data/ext/ffi_c/libffi/ltmain.sh +2 -2
- data/ext/ffi_c/libffi/man/Makefile.in +1 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.in +2 -2
- data/ffi.gemspec +0 -1
- data/lib/ffi/library.rb +2 -2
- data/lib/ffi/platform/aarch64-freebsd/types.conf +2 -2
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +113 -60
- data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
- data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
- data/lib/ffi/platform.rb +2 -5
- data/lib/ffi/tools/const_generator.rb +2 -1
- data/lib/ffi/tools/struct_generator.rb +2 -1
- data/lib/ffi/variadic.rb +0 -9
- data/lib/ffi/version.rb +1 -1
- data/lib/ffi.rb +2 -3
- data/rakelib/ffi_gem_helper.rb +65 -0
- metadata +6 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bcc7a331092d1e4b89f817ea0aa8b3f13a9e58d68df67d9a04a825c16ae65a9
|
4
|
+
data.tar.gz: 8d7e7bbb75e7f19235c7ef6b9e814b09141f8f46b15a248f86fbe95551f26e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf963e42331b77650954eee5aca3c1b2a780bf27f31cf6d85ff048efac8f60b40e484a0883512df5f81c00ce04ba22382e813e71d074f35f9f539c6366b7aa9
|
7
|
+
data.tar.gz: b36841f7eda33b367c877d8e8b3480096582abc73ddbac2a278e33943a9cb3afff1cbc323e0b0fceac3c8ef86f5b4e6d1cbede107f09e9444910dd56bcfa5444
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,64 @@
|
|
1
|
+
1.15.4 / 2021-09-01
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
Fixed:
|
5
|
+
* Fix build for uClibc. #913
|
6
|
+
* Correct module lookup when including `ffi-module` gem. #912
|
7
|
+
|
8
|
+
Changed:
|
9
|
+
* Use ruby code of the ffi gem in JRuby-9.2.20+. #915
|
10
|
+
|
11
|
+
|
12
|
+
1.15.3 / 2021-06-16
|
13
|
+
-------------------
|
14
|
+
|
15
|
+
Fixed:
|
16
|
+
* Fix temporary packaging issue with libffi. #904
|
17
|
+
|
18
|
+
|
19
|
+
1.15.2 / 2021-06-16
|
20
|
+
-------------------
|
21
|
+
|
22
|
+
Added:
|
23
|
+
* Add support for Windows MINGW-UCRT build. #903
|
24
|
+
* Add `/opt/homebrew/lib/` to fallback search paths to improve homebrew support. #880 #882
|
25
|
+
|
26
|
+
Changed:
|
27
|
+
* Regenerate `types.conf` for FreeBSD12 aarch64. #902
|
28
|
+
|
29
|
+
|
30
|
+
1.15.1 / 2021-05-22
|
31
|
+
-------------------
|
32
|
+
|
33
|
+
Fixed:
|
34
|
+
* Append -pthread to linker options. #893
|
35
|
+
* Use arm or aarch64 to identify Apple ARM CPU arch. #899
|
36
|
+
* Allow overriding `gcc` with the `CC` env var in `const_generator.rb` and `struct_generator.rb`. #897
|
37
|
+
|
38
|
+
|
39
|
+
1.15.0 / 2021-03-05
|
40
|
+
-------------------
|
41
|
+
|
42
|
+
Fixed:
|
43
|
+
* Fix MSVC build
|
44
|
+
* Fix async callbacks in conjunction with fork(). #884
|
45
|
+
|
46
|
+
Added:
|
47
|
+
* Allow to pass callbacks in varargs. #885
|
48
|
+
* Name the threads for FFI callback dispatcher and async thread calls for easier debugging. #883
|
49
|
+
The name can be retrieved by Thread.name and is shown by Thread.list.inspect etc.
|
50
|
+
Even gdb shows the thread name on supported operating systems.
|
51
|
+
* Add types.conf for powerpc64le-linux
|
52
|
+
* Add types.conf for riscv64-linux
|
53
|
+
* More release automation of ffi gems
|
54
|
+
|
55
|
+
Changed:
|
56
|
+
* Switch from rubygems-tasks to bundler/gem_helper
|
57
|
+
|
58
|
+
Removed:
|
59
|
+
* Remove unused VariadicInvoker#init
|
60
|
+
|
61
|
+
|
1
62
|
1.14.2 / 2020-12-21
|
2
63
|
-------------------
|
3
64
|
|
data/Gemfile
CHANGED
@@ -5,10 +5,7 @@ group :development do
|
|
5
5
|
gem 'rake-compiler', '~> 1.0.3'
|
6
6
|
gem 'rake-compiler-dock', '~> 1.0'
|
7
7
|
gem 'rspec', '~> 3.0'
|
8
|
-
|
9
|
-
# irb versions > 1.1.1 depend on reline,
|
10
|
-
# which sometimes causes 'bundle install' to fail on Ruby <= 2.4: https://github.com/rubygems/rubygems/issues/3463
|
11
|
-
gem 'rubygems-tasks', '>= 0.2', '< 0.2.5', :require => 'rubygems/tasks'
|
8
|
+
gem 'bundler', '>= 1.16', '< 3'
|
12
9
|
end
|
13
10
|
|
14
11
|
group :doc do
|
data/README.md
CHANGED
@@ -62,6 +62,10 @@ On JRuby and TruffleRuby, there are no requirements to install the FFI gem, and
|
|
62
62
|
From rubygems:
|
63
63
|
|
64
64
|
[sudo] gem install ffi
|
65
|
+
|
66
|
+
From a Gemfile using git or GitHub
|
67
|
+
|
68
|
+
gem 'ffi', github: 'ffi/ffi', submodules: true
|
65
69
|
|
66
70
|
or from the git repository on github:
|
67
71
|
|
data/Rakefile
CHANGED
@@ -1,20 +1,17 @@
|
|
1
|
-
require 'rubygems/tasks'
|
2
1
|
require 'rbconfig'
|
3
|
-
require 'rake/clean'
|
4
|
-
require_relative "lib/ffi/version"
|
5
|
-
|
6
2
|
require 'date'
|
7
3
|
require 'fileutils'
|
8
4
|
require 'rbconfig'
|
9
5
|
require 'rspec/core/rake_task'
|
10
6
|
require 'rubygems/package_task'
|
7
|
+
require 'rake/extensiontask'
|
8
|
+
require_relative "lib/ffi/version"
|
9
|
+
require_relative "rakelib/ffi_gem_helper"
|
11
10
|
|
12
11
|
BUILD_DIR = "build"
|
13
12
|
BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
|
14
13
|
|
15
|
-
|
16
|
-
@gem_spec ||= Gem::Specification.load('ffi.gemspec')
|
17
|
-
end
|
14
|
+
gem_spec = Bundler.load_gemspec('ffi.gemspec')
|
18
15
|
|
19
16
|
RSpec::Core::RakeTask.new(:spec => :compile) do |config|
|
20
17
|
config.rspec_opts = YAML.load_file 'spec/spec.opts'
|
@@ -87,6 +84,10 @@ end
|
|
87
84
|
|
88
85
|
task 'gem:java' => 'java:gem'
|
89
86
|
|
87
|
+
FfiGemHelper.install_tasks
|
88
|
+
# Register windows gems to be pushed to rubygems.org
|
89
|
+
Bundler::GemHelper.instance.cross_platforms = %w[x86-mingw32 x64-mingw32]
|
90
|
+
|
90
91
|
if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
91
92
|
require 'rake/extensiontask'
|
92
93
|
Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
|
@@ -94,21 +95,11 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
94
95
|
# ext.lib_dir = BUILD_DIR # put binaries into this folder.
|
95
96
|
ext.tmp_dir = BUILD_DIR # temporary folder used during compilation.
|
96
97
|
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
97
|
-
ext.cross_platform =
|
98
|
+
ext.cross_platform = Bundler::GemHelper.instance.cross_platforms
|
98
99
|
ext.cross_compiling do |spec|
|
99
100
|
spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
|
100
101
|
end
|
101
|
-
end
|
102
|
-
|
103
|
-
# To reduce the gem file size strip mingw32 dlls before packaging
|
104
|
-
ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
|
105
|
-
task "build/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so" do |t|
|
106
|
-
sh "i686-w64-mingw32-strip -S build/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
107
|
-
end
|
108
102
|
|
109
|
-
task "build/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so" do |t|
|
110
|
-
sh "x86_64-w64-mingw32-strip -S build/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
111
|
-
end
|
112
103
|
end
|
113
104
|
else
|
114
105
|
task :compile do
|
@@ -116,6 +107,7 @@ else
|
|
116
107
|
end
|
117
108
|
end
|
118
109
|
|
110
|
+
|
119
111
|
desc "build a windows gem without all the ceremony"
|
120
112
|
task "gem:windows" do
|
121
113
|
require "rake_compiler_dock"
|
@@ -132,7 +124,7 @@ task :libffi => "ext/ffi_c/libffi/autogen.sh"
|
|
132
124
|
|
133
125
|
LIBFFI_GIT_FILES = `git --git-dir ext/ffi_c/libffi/.git ls-files -z`.split("\x0")
|
134
126
|
|
135
|
-
# Generate files in gemspec but not in libffi's git repo by running autogen.sh
|
127
|
+
# Generate files which are in the gemspec but not in libffi's git repo by running autogen.sh
|
136
128
|
gem_spec.files.select do |f|
|
137
129
|
f =~ /ext\/ffi_c\/libffi\/(.*)/ && !LIBFFI_GIT_FILES.include?($1)
|
138
130
|
end.each do |f|
|
@@ -148,6 +140,11 @@ end.each do |f|
|
|
148
140
|
end
|
149
141
|
end
|
150
142
|
|
143
|
+
# Make sure we have all gemspec files before packaging
|
144
|
+
task :build => gem_spec.files
|
145
|
+
task :gem => :build
|
146
|
+
|
147
|
+
|
151
148
|
require_relative "lib/ffi/platform"
|
152
149
|
types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf'))
|
153
150
|
logfile = File.join(File.dirname(__FILE__), 'types_log')
|
@@ -168,10 +165,6 @@ end
|
|
168
165
|
desc "Create or update type information for platform #{FFI::Platform::NAME}"
|
169
166
|
task :types_conf => types_conf
|
170
167
|
|
171
|
-
Gem::Tasks.new do |t|
|
172
|
-
t.scm.tag.format = '%s'
|
173
|
-
end
|
174
|
-
|
175
168
|
begin
|
176
169
|
require 'yard'
|
177
170
|
|
data/ext/ffi_c/Call.c
CHANGED
@@ -310,7 +310,6 @@ rbffi_SetupCallParams(int argc, VALUE* argv, int paramCount, Type** paramTypes,
|
|
310
310
|
|
311
311
|
|
312
312
|
case NATIVE_FUNCTION:
|
313
|
-
case NATIVE_CALLBACK:
|
314
313
|
if (callbackProc != Qnil) {
|
315
314
|
param->ptr = callback_param(callbackProc, callbackParameters[cbidx++]);
|
316
315
|
} else {
|
data/ext/ffi_c/Function.c
CHANGED
@@ -282,6 +282,17 @@ rbffi_Function_ForProc(VALUE rbFunctionInfo, VALUE proc)
|
|
282
282
|
return callback;
|
283
283
|
}
|
284
284
|
|
285
|
+
#if !defined(_WIN32) && defined(DEFER_ASYNC_CALLBACK)
|
286
|
+
static void
|
287
|
+
after_fork_callback(void)
|
288
|
+
{
|
289
|
+
/* Ensure that a new dispatcher thread is started in a forked process */
|
290
|
+
async_cb_thread = Qnil;
|
291
|
+
pthread_mutex_init(&async_cb_mutex, NULL);
|
292
|
+
pthread_cond_init(&async_cb_cond, NULL);
|
293
|
+
}
|
294
|
+
#endif
|
295
|
+
|
285
296
|
static VALUE
|
286
297
|
function_init(VALUE self, VALUE rbFunctionInfo, VALUE rbProc)
|
287
298
|
{
|
@@ -309,7 +320,16 @@ function_init(VALUE self, VALUE rbFunctionInfo, VALUE rbProc)
|
|
309
320
|
|
310
321
|
#if defined(DEFER_ASYNC_CALLBACK)
|
311
322
|
if (async_cb_thread == Qnil) {
|
323
|
+
|
324
|
+
#if !defined(_WIN32)
|
325
|
+
if( pthread_atfork(NULL, NULL, after_fork_callback) ){
|
326
|
+
rb_warn("FFI: unable to register fork callback");
|
327
|
+
}
|
328
|
+
#endif
|
329
|
+
|
312
330
|
async_cb_thread = rb_thread_create(async_cb_event, NULL);
|
331
|
+
/* Name thread, for better debugging */
|
332
|
+
rb_funcall(async_cb_thread, rb_intern("name="), 1, rb_str_new2("FFI Callback Dispatcher"));
|
313
333
|
}
|
314
334
|
#endif
|
315
335
|
|
@@ -525,7 +545,9 @@ async_cb_event(void* unused)
|
|
525
545
|
rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w);
|
526
546
|
if (w.cb != NULL) {
|
527
547
|
/* Start up a new ruby thread to run the ruby callback */
|
528
|
-
rb_thread_create(async_cb_call, w.cb);
|
548
|
+
VALUE new_thread = rb_thread_create(async_cb_call, w.cb);
|
549
|
+
/* Name thread, for better debugging */
|
550
|
+
rb_funcall(new_thread, rb_intern("name="), 1, rb_str_new2("FFI Callback Runner"));
|
529
551
|
}
|
530
552
|
}
|
531
553
|
|
@@ -711,7 +733,6 @@ invoke_callback(VALUE data)
|
|
711
733
|
break;
|
712
734
|
|
713
735
|
case NATIVE_FUNCTION:
|
714
|
-
case NATIVE_CALLBACK:
|
715
736
|
case NATIVE_STRUCT:
|
716
737
|
param = rbffi_NativeValue_ToRuby(paramType, rbParamType, parameters[i]);
|
717
738
|
break;
|
@@ -787,7 +808,6 @@ invoke_callback(VALUE data)
|
|
787
808
|
break;
|
788
809
|
|
789
810
|
case NATIVE_FUNCTION:
|
790
|
-
case NATIVE_CALLBACK:
|
791
811
|
if (TYPE(rbReturnValue) == T_DATA && rb_obj_is_kind_of(rbReturnValue, rbffi_PointerClass)) {
|
792
812
|
|
793
813
|
*((void **) retval) = ((AbstractMemory *) DATA_PTR(rbReturnValue))->address;
|
data/ext/ffi_c/Function.h
CHANGED
data/ext/ffi_c/MemoryPointer.h
CHANGED
data/ext/ffi_c/Platform.c
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
#include "rbffi_endian.h"
|
39
39
|
#include "Platform.h"
|
40
40
|
|
41
|
-
#if defined(__GNU__) || defined(__GLIBC__)
|
41
|
+
#if defined(__GNU__) || (defined(__GLIBC__) && !defined(__UCLIBC__))
|
42
42
|
# include <gnu/lib-names.h>
|
43
43
|
#endif
|
44
44
|
|
@@ -71,7 +71,7 @@ rbffi_Platform_Init(VALUE moduleFFI)
|
|
71
71
|
rb_define_const(PlatformModule, "BYTE_ORDER", INT2FIX(BYTE_ORDER));
|
72
72
|
rb_define_const(PlatformModule, "LITTLE_ENDIAN", INT2FIX(LITTLE_ENDIAN));
|
73
73
|
rb_define_const(PlatformModule, "BIG_ENDIAN", INT2FIX(BIG_ENDIAN));
|
74
|
-
#if defined(__GNU__) || defined(__GLIBC__)
|
74
|
+
#if defined(__GNU__) || (defined(__GLIBC__) && !defined(__UCLIBC__))
|
75
75
|
rb_define_const(PlatformModule, "GNU_LIBC", rb_str_new2(LIBC_SO));
|
76
76
|
#endif
|
77
77
|
export_primitive_types(PlatformModule);
|
data/ext/ffi_c/Pointer.h
CHANGED
data/ext/ffi_c/StructLayout.c
CHANGED
@@ -123,7 +123,6 @@ struct_field_initialize(int argc, VALUE* argv, VALUE self)
|
|
123
123
|
|
124
124
|
switch (field->type->nativeType == NATIVE_MAPPED ? ((MappedType *) field->type)->type->nativeType : field->type->nativeType) {
|
125
125
|
case NATIVE_FUNCTION:
|
126
|
-
case NATIVE_CALLBACK:
|
127
126
|
case NATIVE_POINTER:
|
128
127
|
field->referenceRequired = true;
|
129
128
|
break;
|
data/ext/ffi_c/Types.c
CHANGED
@@ -85,10 +85,9 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
85
85
|
return rbffi_Pointer_NewInstance(*(void **) ptr);
|
86
86
|
case NATIVE_BOOL:
|
87
87
|
return ((unsigned char) *(ffi_arg *) ptr) ? Qtrue : Qfalse;
|
88
|
-
|
89
|
-
case NATIVE_FUNCTION:
|
90
|
-
|
91
|
-
return *(void **) ptr != NULL
|
88
|
+
|
89
|
+
case NATIVE_FUNCTION: {
|
90
|
+
return *(void **) ptr != NULL
|
92
91
|
? rbffi_Function_NewInstance(rbType, rbffi_Pointer_NewInstance(*(void **) ptr))
|
93
92
|
: Qnil;
|
94
93
|
}
|
@@ -116,15 +115,15 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
116
115
|
|
117
116
|
values[0] = rbffi_NativeValue_ToRuby(m->type, m->rbType, ptr);
|
118
117
|
values[1] = Qnil;
|
119
|
-
|
118
|
+
|
120
119
|
|
121
120
|
rbReturnValue = rb_funcall2(m->rbConverter, id_from_native, 2, values);
|
122
121
|
RB_GC_GUARD(values[0]);
|
123
122
|
RB_GC_GUARD(rbType);
|
124
|
-
|
123
|
+
|
125
124
|
return rbReturnValue;
|
126
125
|
}
|
127
|
-
|
126
|
+
|
128
127
|
default:
|
129
128
|
rb_raise(rb_eRuntimeError, "Unknown type: %d", type->nativeType);
|
130
129
|
return Qnil;
|
data/ext/ffi_c/Types.h
CHANGED
@@ -51,20 +51,19 @@ typedef enum {
|
|
51
51
|
NATIVE_FLOAT64,
|
52
52
|
NATIVE_LONGDOUBLE,
|
53
53
|
NATIVE_POINTER,
|
54
|
-
NATIVE_CALLBACK,
|
55
54
|
NATIVE_FUNCTION,
|
56
55
|
NATIVE_BUFFER_IN,
|
57
56
|
NATIVE_BUFFER_OUT,
|
58
57
|
NATIVE_BUFFER_INOUT,
|
59
58
|
NATIVE_CHAR_ARRAY,
|
60
59
|
NATIVE_BOOL,
|
61
|
-
|
60
|
+
|
62
61
|
/** An immutable string. Nul terminated, but only copies in to the native function */
|
63
62
|
NATIVE_STRING,
|
64
|
-
|
63
|
+
|
65
64
|
/** The function takes a variable number of arguments */
|
66
65
|
NATIVE_VARARGS,
|
67
|
-
|
66
|
+
|
68
67
|
/** Struct-by-value param or result */
|
69
68
|
NATIVE_STRUCT,
|
70
69
|
|
data/ext/ffi_c/Variadic.c
CHANGED
@@ -168,7 +168,8 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
168
168
|
ffi_type* ffiReturnType;
|
169
169
|
Type** paramTypes;
|
170
170
|
VALUE* argv;
|
171
|
-
|
171
|
+
VALUE* callbackParameters;
|
172
|
+
int paramCount = 0, fixedCount = 0, callbackCount = 0, i;
|
172
173
|
ffi_status ffiStatus;
|
173
174
|
rbffi_frame_t frame = { 0 };
|
174
175
|
|
@@ -182,6 +183,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
182
183
|
params = ALLOCA_N(FFIStorage, paramCount);
|
183
184
|
ffiValues = ALLOCA_N(void*, paramCount);
|
184
185
|
argv = ALLOCA_N(VALUE, paramCount);
|
186
|
+
callbackParameters = ALLOCA_N(VALUE, paramCount);
|
185
187
|
retval = alloca(MAX(invoker->returnType->ffiType->size, FFI_SIZEOF_ARG));
|
186
188
|
|
187
189
|
for (i = 0; i < paramCount; ++i) {
|
@@ -211,6 +213,14 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
211
213
|
Data_Get_Struct(rbType, Type, paramTypes[i]);
|
212
214
|
break;
|
213
215
|
|
216
|
+
case NATIVE_FUNCTION:
|
217
|
+
if (!rb_obj_is_kind_of(rbType, rbffi_FunctionTypeClass)) {
|
218
|
+
VALUE typeName = rb_funcall2(rbType, rb_intern("inspect"), 0, NULL);
|
219
|
+
rb_raise(rb_eTypeError, "Incorrect parameter type (%s)", RSTRING_PTR(typeName));
|
220
|
+
}
|
221
|
+
callbackParameters[callbackCount++] = rbType;
|
222
|
+
break;
|
223
|
+
|
214
224
|
default:
|
215
225
|
break;
|
216
226
|
}
|
@@ -248,7 +258,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
248
258
|
}
|
249
259
|
|
250
260
|
rbffi_SetupCallParams(paramCount, argv, -1, paramTypes, params,
|
251
|
-
ffiValues,
|
261
|
+
ffiValues, callbackParameters, callbackCount, invoker->rbEnums);
|
252
262
|
|
253
263
|
rbffi_frame_push(&frame);
|
254
264
|
|
data/ext/ffi_c/extconf.rb
CHANGED
@@ -57,7 +57,10 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
57
57
|
append_ldflags "-Wl,--exclude-libs,ALL"
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
# Some linux archs need explicit linking to pthread, see https://github.com/ffi/ffi/issues/893
|
61
|
+
append_ldflags "-pthread"
|
62
|
+
|
63
|
+
ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm|aarch64/i
|
61
64
|
if enable_config('libffi-alloc', ffi_alloc_default)
|
62
65
|
$defs << "-DUSE_FFI_ALLOC"
|
63
66
|
end
|
@@ -71,7 +74,7 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
71
74
|
File.open("Makefile", "a") do |mf|
|
72
75
|
mf.puts "LIBFFI_HOST=--host=#{RbConfig::CONFIG['host_alias']}" if RbConfig::CONFIG.has_key?("host_alias")
|
73
76
|
if RbConfig::CONFIG['host_os'] =~ /darwin/i
|
74
|
-
if RbConfig::CONFIG['host'] =~ /arm/i
|
77
|
+
if RbConfig::CONFIG['host'] =~ /arm|aarch64/i
|
75
78
|
mf.puts "LIBFFI_HOST=--host=aarch64-apple-#{RbConfig::CONFIG['host_os']}"
|
76
79
|
end
|
77
80
|
mf.puts "include ${srcdir}/libffi.darwin.mk"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Makefile.in generated by automake 1.16.
|
1
|
+
# Makefile.in generated by automake 1.16.3 from Makefile.am.
|
2
2
|
# @configure_input@
|
3
3
|
|
4
4
|
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
@@ -368,6 +368,8 @@ am__relativize = \
|
|
368
368
|
DIST_ARCHIVES = $(distdir).tar.gz
|
369
369
|
GZIP_ENV = --best
|
370
370
|
DIST_TARGETS = dist-gzip
|
371
|
+
# Exists only to be overridden by the user if desired.
|
372
|
+
AM_DISTCHECK_DVI_TARGET = dvi
|
371
373
|
distuninstallcheck_listfiles = find . -type f -print
|
372
374
|
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
373
375
|
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
@@ -1615,7 +1617,7 @@ distcheck: dist
|
|
1615
1617
|
$(DISTCHECK_CONFIGURE_FLAGS) \
|
1616
1618
|
--srcdir=../.. --prefix="$$dc_install_base" \
|
1617
1619
|
&& $(MAKE) $(AM_MAKEFLAGS) \
|
1618
|
-
&& $(MAKE) $(AM_MAKEFLAGS)
|
1620
|
+
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
|
1619
1621
|
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
1620
1622
|
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
1621
1623
|
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
data/ext/ffi_c/libffi/configure
CHANGED
@@ -3094,12 +3094,7 @@ ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
|
|
3094
3094
|
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
|
3095
3095
|
|
3096
3096
|
if test x"${MISSING+set}" != xset; then
|
3097
|
-
|
3098
|
-
*\ * | *\ *)
|
3099
|
-
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
3100
|
-
*)
|
3101
|
-
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
3102
|
-
esac
|
3097
|
+
MISSING="\${SHELL} '$am_aux_dir/missing'"
|
3103
3098
|
fi
|
3104
3099
|
# Use eval to expand $SHELL
|
3105
3100
|
if eval "$MISSING --is-lightweight"; then
|
@@ -7174,8 +7169,11 @@ _LT_EOF
|
|
7174
7169
|
test $ac_status = 0; }; then
|
7175
7170
|
# Now try to grab the symbols.
|
7176
7171
|
nlist=conftest.nm
|
7177
|
-
|
7178
|
-
|
7172
|
+
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
|
7173
|
+
(eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
|
7174
|
+
ac_status=$?
|
7175
|
+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
7176
|
+
test $ac_status = 0; } && test -s "$nlist"; then
|
7179
7177
|
# Try sorting and uniquifying the output.
|
7180
7178
|
if sort "$nlist" | uniq > "$nlist"T; then
|
7181
7179
|
mv -f "$nlist"T "$nlist"
|
@@ -9535,12 +9533,6 @@ lt_prog_compiler_static=
|
|
9535
9533
|
lt_prog_compiler_pic='-KPIC'
|
9536
9534
|
lt_prog_compiler_static='-static'
|
9537
9535
|
;;
|
9538
|
-
# flang / f18. f95 an alias for gfortran or flang on Debian
|
9539
|
-
flang* | f18* | f95*)
|
9540
|
-
lt_prog_compiler_wl='-Wl,'
|
9541
|
-
lt_prog_compiler_pic='-fPIC'
|
9542
|
-
lt_prog_compiler_static='-static'
|
9543
|
-
;;
|
9544
9536
|
# icc used to be incompatible with GCC.
|
9545
9537
|
# ICC 10 doesn't accept -KPIC any more.
|
9546
9538
|
icc* | ifort*)
|
@@ -13483,7 +13475,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
|
|
13483
13475
|
# Commands to make compiler produce verbose output that lists
|
13484
13476
|
# what "hidden" libraries, object files and flags are used when
|
13485
13477
|
# linking a shared library.
|
13486
|
-
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "
|
13478
|
+
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
13487
13479
|
|
13488
13480
|
else
|
13489
13481
|
GXX=no
|
@@ -13975,7 +13967,7 @@ fi
|
|
13975
13967
|
# explicitly linking system object files so we need to strip them
|
13976
13968
|
# from the output so that they don't get included in the library
|
13977
13969
|
# dependencies.
|
13978
|
-
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "
|
13970
|
+
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
|
13979
13971
|
;;
|
13980
13972
|
*)
|
13981
13973
|
if test yes = "$GXX"; then
|
@@ -14040,7 +14032,7 @@ fi
|
|
14040
14032
|
# explicitly linking system object files so we need to strip them
|
14041
14033
|
# from the output so that they don't get included in the library
|
14042
14034
|
# dependencies.
|
14043
|
-
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "
|
14035
|
+
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
|
14044
14036
|
;;
|
14045
14037
|
*)
|
14046
14038
|
if test yes = "$GXX"; then
|
@@ -14379,7 +14371,7 @@ fi
|
|
14379
14371
|
# Commands to make compiler produce verbose output that lists
|
14380
14372
|
# what "hidden" libraries, object files and flags are used when
|
14381
14373
|
# linking a shared library.
|
14382
|
-
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "
|
14374
|
+
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
14383
14375
|
|
14384
14376
|
else
|
14385
14377
|
# FIXME: insert proper C++ library support
|
@@ -14463,7 +14455,7 @@ fi
|
|
14463
14455
|
# Commands to make compiler produce verbose output that lists
|
14464
14456
|
# what "hidden" libraries, object files and flags are used when
|
14465
14457
|
# linking a shared library.
|
14466
|
-
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "
|
14458
|
+
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
14467
14459
|
else
|
14468
14460
|
# g++ 2.7 appears to require '-G' NOT '-shared' on this
|
14469
14461
|
# platform.
|
@@ -14474,7 +14466,7 @@ fi
|
|
14474
14466
|
# Commands to make compiler produce verbose output that lists
|
14475
14467
|
# what "hidden" libraries, object files and flags are used when
|
14476
14468
|
# linking a shared library.
|
14477
|
-
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "
|
14469
|
+
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
|
14478
14470
|
fi
|
14479
14471
|
|
14480
14472
|
hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir'
|