ffi 1.14.2 → 1.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -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/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/lib/ffi.rb +1 -2
- data/lib/ffi/library.rb +1 -1
- data/lib/ffi/platform.rb +2 -5
- 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/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/rakelib/ffi_gem_helper.rb +65 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64acbe6068a72fc276ab3f25bc3819921a0ffe01a0d5e0e87ab32a89aeae32e6
|
4
|
+
data.tar.gz: 5d7d19abdf7e0f071edf0ff6dfd01e061bcc5edebc7f28133f58dd83789cdc8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b013541765cc7c9dc4fd14373eb47b1875ab36dab9e4044bb99cbc362932fc0a2ac2ef2d802e672304407187163c1a65246e8b5d82cdcb6ce1b2711e2995dcc
|
7
|
+
data.tar.gz: 6f47e3a6521db25b2dac5b01b295e2831d87ded589dd14658edf7aaa82af51faba4be3fb0fd93fe41a693c6fc803ba3eb53466605cf682d33915c824a8440ec2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,53 @@
|
|
1
|
+
1.15.3 / 2021-06-16
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
Fixed:
|
5
|
+
* Fix temporary packaging issue with libffi. #904
|
6
|
+
|
7
|
+
|
8
|
+
1.15.2 / 2021-06-16
|
9
|
+
-------------------
|
10
|
+
|
11
|
+
Added:
|
12
|
+
* Add support for Windows MINGW-UCRT build. #903
|
13
|
+
* Add `/opt/homebrew/lib/` to fallback search paths to improve homebrew support. #880 #882
|
14
|
+
|
15
|
+
Changed:
|
16
|
+
* Regenerate `types.conf` for FreeBSD12 aarch64. #902
|
17
|
+
|
18
|
+
|
19
|
+
1.15.1 / 2021-05-22
|
20
|
+
-------------------
|
21
|
+
|
22
|
+
Fixed:
|
23
|
+
* Append -pthread to linker options. #893
|
24
|
+
* Use arm or aarch64 to identify Apple ARM CPU arch. #899
|
25
|
+
* Allow overriding `gcc` with the `CC` env var in `const_generator.rb` and `struct_generator.rb`. #897
|
26
|
+
|
27
|
+
|
28
|
+
1.15.0 / 2021-03-05
|
29
|
+
-------------------
|
30
|
+
|
31
|
+
Fixed:
|
32
|
+
* Fix MSVC build
|
33
|
+
* Fix async callbacks in conjunction with fork(). #884
|
34
|
+
|
35
|
+
Added:
|
36
|
+
* Allow to pass callbacks in varargs. #885
|
37
|
+
* Name the threads for FFI callback dispatcher and async thread calls for easier debugging. #883
|
38
|
+
The name can be retrieved by Thread.name and is shown by Thread.list.inspect etc.
|
39
|
+
Even gdb shows the thread name on supported operating systems.
|
40
|
+
* Add types.conf for powerpc64le-linux
|
41
|
+
* Add types.conf for riscv64-linux
|
42
|
+
* More release automation of ffi gems
|
43
|
+
|
44
|
+
Changed:
|
45
|
+
* Switch from rubygems-tasks to bundler/gem_helper
|
46
|
+
|
47
|
+
Removed:
|
48
|
+
* Remove unused VariadicInvoker#init
|
49
|
+
|
50
|
+
|
1
51
|
1.14.2 / 2020-12-21
|
2
52
|
-------------------
|
3
53
|
|
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/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"
|
data/lib/ffi.rb
CHANGED
data/lib/ffi/library.rb
CHANGED
@@ -126,7 +126,7 @@ module FFI
|
|
126
126
|
else
|
127
127
|
# TODO better library lookup logic
|
128
128
|
unless libname.start_with?("/") || FFI::Platform.windows?
|
129
|
-
path = ['/usr/lib/','/usr/local/lib/','/opt/local/lib/'].find do |pth|
|
129
|
+
path = ['/usr/lib/','/usr/local/lib/','/opt/local/lib/', '/opt/homebrew/lib/'].find do |pth|
|
130
130
|
File.exist?(pth + libname)
|
131
131
|
end
|
132
132
|
if path
|
data/lib/ffi/platform.rb
CHANGED
@@ -132,11 +132,8 @@ module FFI
|
|
132
132
|
end
|
133
133
|
|
134
134
|
LIBC = if IS_WINDOWS
|
135
|
-
|
136
|
-
|
137
|
-
else
|
138
|
-
"ucrtbase.dll"
|
139
|
-
end
|
135
|
+
crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'
|
136
|
+
"#{crtname}.dll"
|
140
137
|
elsif IS_GNU
|
141
138
|
GNU_LIBC
|
142
139
|
elsif OS == 'cygwin'
|
@@ -39,9 +39,9 @@ rbx.platform.typedef.__segsz_t = int
|
|
39
39
|
rbx.platform.typedef.__size_t = ulong
|
40
40
|
rbx.platform.typedef.__socklen_t = uint
|
41
41
|
rbx.platform.typedef.__ssize_t = long
|
42
|
-
rbx.platform.typedef.__suseconds_t =
|
42
|
+
rbx.platform.typedef.__suseconds_t = long
|
43
43
|
rbx.platform.typedef.__swblk_t = int
|
44
|
-
rbx.platform.typedef.__time_t =
|
44
|
+
rbx.platform.typedef.__time_t = long
|
45
45
|
rbx.platform.typedef.__timer_t = int
|
46
46
|
rbx.platform.typedef.__uid_t = uint
|
47
47
|
rbx.platform.typedef.__uint16_t = ushort
|
@@ -1,128 +1,181 @@
|
|
1
|
+
rbx.platform.typedef.*) = pointer
|
2
|
+
rbx.platform.typedef.___wchar_t = uint
|
3
|
+
rbx.platform.typedef.__accmode_t = int
|
4
|
+
rbx.platform.typedef.__blkcnt_t = long
|
5
|
+
rbx.platform.typedef.__blksize_t = int
|
6
|
+
rbx.platform.typedef.__char16_t = ushort
|
7
|
+
rbx.platform.typedef.__char32_t = uint
|
1
8
|
rbx.platform.typedef.__clock_t = int
|
2
9
|
rbx.platform.typedef.__clockid_t = int
|
3
|
-
rbx.platform.typedef.
|
4
|
-
rbx.platform.typedef.
|
5
|
-
rbx.platform.typedef.
|
10
|
+
rbx.platform.typedef.__cpulevel_t = int
|
11
|
+
rbx.platform.typedef.__cpusetid_t = int
|
12
|
+
rbx.platform.typedef.__cpuwhich_t = int
|
13
|
+
rbx.platform.typedef.__critical_t = long
|
14
|
+
rbx.platform.typedef.__ct_rune_t = int
|
15
|
+
rbx.platform.typedef.__daddr_t = long
|
16
|
+
rbx.platform.typedef.__dev_t = ulong
|
17
|
+
rbx.platform.typedef.__fd_mask = ulong
|
18
|
+
rbx.platform.typedef.__fflags_t = uint
|
6
19
|
rbx.platform.typedef.__fixpt_t = uint
|
20
|
+
rbx.platform.typedef.__fsblkcnt_t = ulong
|
21
|
+
rbx.platform.typedef.__fsfilcnt_t = ulong
|
7
22
|
rbx.platform.typedef.__gid_t = uint
|
8
|
-
rbx.platform.typedef.__id_t =
|
9
|
-
rbx.platform.typedef.
|
10
|
-
rbx.platform.typedef.__in_port_t = ushort
|
11
|
-
rbx.platform.typedef.__ino_t = ulong_long
|
23
|
+
rbx.platform.typedef.__id_t = long
|
24
|
+
rbx.platform.typedef.__ino_t = ulong
|
12
25
|
rbx.platform.typedef.__int16_t = short
|
13
26
|
rbx.platform.typedef.__int32_t = int
|
14
|
-
rbx.platform.typedef.__int64_t =
|
27
|
+
rbx.platform.typedef.__int64_t = long
|
15
28
|
rbx.platform.typedef.__int8_t = char
|
16
29
|
rbx.platform.typedef.__int_fast16_t = int
|
17
30
|
rbx.platform.typedef.__int_fast32_t = int
|
18
|
-
rbx.platform.typedef.__int_fast64_t =
|
31
|
+
rbx.platform.typedef.__int_fast64_t = long
|
19
32
|
rbx.platform.typedef.__int_fast8_t = int
|
20
33
|
rbx.platform.typedef.__int_least16_t = short
|
21
34
|
rbx.platform.typedef.__int_least32_t = int
|
22
|
-
rbx.platform.typedef.__int_least64_t =
|
35
|
+
rbx.platform.typedef.__int_least64_t = long
|
23
36
|
rbx.platform.typedef.__int_least8_t = char
|
24
|
-
rbx.platform.typedef.
|
37
|
+
rbx.platform.typedef.__intfptr_t = long
|
38
|
+
rbx.platform.typedef.__intmax_t = long
|
25
39
|
rbx.platform.typedef.__intptr_t = long
|
26
40
|
rbx.platform.typedef.__key_t = long
|
27
|
-
rbx.platform.typedef.
|
28
|
-
rbx.platform.typedef.
|
29
|
-
rbx.platform.typedef.
|
30
|
-
rbx.platform.typedef.
|
41
|
+
rbx.platform.typedef.__lwpid_t = int
|
42
|
+
rbx.platform.typedef.__mode_t = ushort
|
43
|
+
rbx.platform.typedef.__nl_item = int
|
44
|
+
rbx.platform.typedef.__nlink_t = ulong
|
45
|
+
rbx.platform.typedef.__off64_t = long
|
46
|
+
rbx.platform.typedef.__off_t = long
|
31
47
|
rbx.platform.typedef.__pid_t = int
|
32
|
-
rbx.platform.typedef.__psize_t = ulong
|
33
48
|
rbx.platform.typedef.__ptrdiff_t = long
|
34
|
-
rbx.platform.typedef.__register_t =
|
35
|
-
rbx.platform.typedef.__rlim_t =
|
49
|
+
rbx.platform.typedef.__register_t = long
|
50
|
+
rbx.platform.typedef.__rlim_t = long
|
51
|
+
rbx.platform.typedef.__rman_res_t = ulong
|
36
52
|
rbx.platform.typedef.__rune_t = int
|
37
53
|
rbx.platform.typedef.__sa_family_t = uchar
|
38
|
-
rbx.platform.typedef.__segsz_t =
|
54
|
+
rbx.platform.typedef.__segsz_t = long
|
39
55
|
rbx.platform.typedef.__size_t = ulong
|
40
56
|
rbx.platform.typedef.__socklen_t = uint
|
41
57
|
rbx.platform.typedef.__ssize_t = long
|
42
|
-
rbx.platform.typedef.__suseconds_t =
|
43
|
-
rbx.platform.typedef.
|
44
|
-
rbx.platform.typedef.
|
45
|
-
rbx.platform.typedef.__timer_t = int
|
58
|
+
rbx.platform.typedef.__suseconds_t = long
|
59
|
+
rbx.platform.typedef.__time_t = long
|
60
|
+
rbx.platform.typedef.__u_register_t = ulong
|
46
61
|
rbx.platform.typedef.__uid_t = uint
|
47
62
|
rbx.platform.typedef.__uint16_t = ushort
|
48
63
|
rbx.platform.typedef.__uint32_t = uint
|
49
|
-
rbx.platform.typedef.__uint64_t =
|
64
|
+
rbx.platform.typedef.__uint64_t = ulong
|
50
65
|
rbx.platform.typedef.__uint8_t = uchar
|
51
66
|
rbx.platform.typedef.__uint_fast16_t = uint
|
52
67
|
rbx.platform.typedef.__uint_fast32_t = uint
|
53
|
-
rbx.platform.typedef.__uint_fast64_t =
|
68
|
+
rbx.platform.typedef.__uint_fast64_t = ulong
|
54
69
|
rbx.platform.typedef.__uint_fast8_t = uint
|
55
70
|
rbx.platform.typedef.__uint_least16_t = ushort
|
56
71
|
rbx.platform.typedef.__uint_least32_t = uint
|
57
|
-
rbx.platform.typedef.__uint_least64_t =
|
72
|
+
rbx.platform.typedef.__uint_least64_t = ulong
|
58
73
|
rbx.platform.typedef.__uint_least8_t = uchar
|
59
|
-
rbx.platform.typedef.
|
74
|
+
rbx.platform.typedef.__uintfptr_t = ulong
|
75
|
+
rbx.platform.typedef.__uintmax_t = ulong
|
60
76
|
rbx.platform.typedef.__uintptr_t = ulong
|
61
77
|
rbx.platform.typedef.__useconds_t = uint
|
62
|
-
rbx.platform.typedef.
|
63
|
-
rbx.platform.typedef.
|
64
|
-
rbx.platform.typedef.
|
65
|
-
rbx.platform.typedef.__wctrans_t = pointer
|
66
|
-
rbx.platform.typedef.__wctype_t = pointer
|
78
|
+
rbx.platform.typedef.__vm_offset_t = ulong
|
79
|
+
rbx.platform.typedef.__vm_paddr_t = ulong
|
80
|
+
rbx.platform.typedef.__vm_size_t = ulong
|
67
81
|
rbx.platform.typedef.__wint_t = int
|
82
|
+
rbx.platform.typedef.accmode_t = int
|
83
|
+
rbx.platform.typedef.blkcnt_t = long
|
84
|
+
rbx.platform.typedef.blksize_t = int
|
85
|
+
rbx.platform.typedef.c_caddr_t = pointer
|
68
86
|
rbx.platform.typedef.caddr_t = string
|
87
|
+
rbx.platform.typedef.cap_ioctl_t = ulong
|
69
88
|
rbx.platform.typedef.clock_t = int
|
70
89
|
rbx.platform.typedef.clockid_t = int
|
71
|
-
rbx.platform.typedef.
|
72
|
-
rbx.platform.typedef.
|
73
|
-
rbx.platform.typedef.
|
74
|
-
rbx.platform.typedef.
|
75
|
-
rbx.platform.typedef.
|
90
|
+
rbx.platform.typedef.cpulevel_t = int
|
91
|
+
rbx.platform.typedef.cpusetid_t = int
|
92
|
+
rbx.platform.typedef.cpuwhich_t = int
|
93
|
+
rbx.platform.typedef.critical_t = long
|
94
|
+
rbx.platform.typedef.daddr_t = long
|
95
|
+
rbx.platform.typedef.dev_t = ulong
|
96
|
+
rbx.platform.typedef.fd_mask = ulong
|
97
|
+
rbx.platform.typedef.fflags_t = uint
|
76
98
|
rbx.platform.typedef.fixpt_t = uint
|
99
|
+
rbx.platform.typedef.fsblkcnt_t = ulong
|
100
|
+
rbx.platform.typedef.fsfilcnt_t = ulong
|
77
101
|
rbx.platform.typedef.gid_t = uint
|
78
|
-
rbx.platform.typedef.id_t =
|
102
|
+
rbx.platform.typedef.id_t = long
|
79
103
|
rbx.platform.typedef.in_addr_t = uint
|
80
104
|
rbx.platform.typedef.in_port_t = ushort
|
81
|
-
rbx.platform.typedef.ino_t =
|
105
|
+
rbx.platform.typedef.ino_t = ulong
|
82
106
|
rbx.platform.typedef.int16_t = short
|
83
107
|
rbx.platform.typedef.int32_t = int
|
84
|
-
rbx.platform.typedef.int64_t =
|
108
|
+
rbx.platform.typedef.int64_t = long
|
85
109
|
rbx.platform.typedef.int8_t = char
|
110
|
+
rbx.platform.typedef.int_fast16_t = int
|
111
|
+
rbx.platform.typedef.int_fast32_t = int
|
112
|
+
rbx.platform.typedef.int_fast64_t = long
|
113
|
+
rbx.platform.typedef.int_fast8_t = int
|
114
|
+
rbx.platform.typedef.int_least16_t = short
|
115
|
+
rbx.platform.typedef.int_least32_t = int
|
116
|
+
rbx.platform.typedef.int_least64_t = long
|
117
|
+
rbx.platform.typedef.int_least8_t = char
|
118
|
+
rbx.platform.typedef.intmax_t = long
|
86
119
|
rbx.platform.typedef.intptr_t = long
|
87
120
|
rbx.platform.typedef.key_t = long
|
88
|
-
rbx.platform.typedef.
|
89
|
-
rbx.platform.typedef.
|
90
|
-
rbx.platform.typedef.
|
91
|
-
rbx.platform.typedef.
|
121
|
+
rbx.platform.typedef.kpaddr_t = ulong
|
122
|
+
rbx.platform.typedef.ksize_t = ulong
|
123
|
+
rbx.platform.typedef.kssize_t = long
|
124
|
+
rbx.platform.typedef.kvaddr_t = ulong
|
125
|
+
rbx.platform.typedef.lwpid_t = int
|
126
|
+
rbx.platform.typedef.mode_t = ushort
|
127
|
+
rbx.platform.typedef.nlink_t = ulong
|
128
|
+
rbx.platform.typedef.off64_t = long
|
129
|
+
rbx.platform.typedef.off_t = long
|
92
130
|
rbx.platform.typedef.pid_t = int
|
93
|
-
rbx.platform.typedef.
|
131
|
+
rbx.platform.typedef.pthread_key_t = int
|
132
|
+
rbx.platform.typedef.ptrdiff_t = long
|
94
133
|
rbx.platform.typedef.qaddr_t = pointer
|
95
|
-
rbx.platform.typedef.quad_t =
|
96
|
-
rbx.platform.typedef.register_t =
|
97
|
-
rbx.platform.typedef.rlim_t =
|
134
|
+
rbx.platform.typedef.quad_t = long
|
135
|
+
rbx.platform.typedef.register_t = long
|
136
|
+
rbx.platform.typedef.rlim_t = long
|
137
|
+
rbx.platform.typedef.rman_res_t = ulong
|
138
|
+
rbx.platform.typedef.rsize_t = ulong
|
139
|
+
rbx.platform.typedef.rune_t = int
|
98
140
|
rbx.platform.typedef.sa_family_t = uchar
|
99
|
-
rbx.platform.typedef.
|
141
|
+
rbx.platform.typedef.sbintime_t = long
|
142
|
+
rbx.platform.typedef.segsz_t = long
|
100
143
|
rbx.platform.typedef.size_t = ulong
|
101
144
|
rbx.platform.typedef.socklen_t = uint
|
102
145
|
rbx.platform.typedef.ssize_t = long
|
103
|
-
rbx.platform.typedef.suseconds_t =
|
104
|
-
rbx.platform.typedef.
|
105
|
-
rbx.platform.typedef.time_t = int
|
106
|
-
rbx.platform.typedef.timer_t = int
|
146
|
+
rbx.platform.typedef.suseconds_t = long
|
147
|
+
rbx.platform.typedef.time_t = long
|
107
148
|
rbx.platform.typedef.u_char = uchar
|
108
149
|
rbx.platform.typedef.u_int = uint
|
109
150
|
rbx.platform.typedef.u_int16_t = ushort
|
110
151
|
rbx.platform.typedef.u_int32_t = uint
|
111
|
-
rbx.platform.typedef.u_int64_t =
|
152
|
+
rbx.platform.typedef.u_int64_t = ulong
|
112
153
|
rbx.platform.typedef.u_int8_t = uchar
|
113
154
|
rbx.platform.typedef.u_long = ulong
|
114
|
-
rbx.platform.typedef.u_quad_t =
|
155
|
+
rbx.platform.typedef.u_quad_t = ulong
|
156
|
+
rbx.platform.typedef.u_register_t = ulong
|
115
157
|
rbx.platform.typedef.u_short = ushort
|
116
158
|
rbx.platform.typedef.uid_t = uint
|
117
159
|
rbx.platform.typedef.uint = uint
|
118
160
|
rbx.platform.typedef.uint16_t = ushort
|
119
161
|
rbx.platform.typedef.uint32_t = uint
|
120
|
-
rbx.platform.typedef.uint64_t =
|
162
|
+
rbx.platform.typedef.uint64_t = ulong
|
121
163
|
rbx.platform.typedef.uint8_t = uchar
|
164
|
+
rbx.platform.typedef.uint_fast16_t = uint
|
165
|
+
rbx.platform.typedef.uint_fast32_t = uint
|
166
|
+
rbx.platform.typedef.uint_fast64_t = ulong
|
167
|
+
rbx.platform.typedef.uint_fast8_t = uint
|
168
|
+
rbx.platform.typedef.uint_least16_t = ushort
|
169
|
+
rbx.platform.typedef.uint_least32_t = uint
|
170
|
+
rbx.platform.typedef.uint_least64_t = ulong
|
171
|
+
rbx.platform.typedef.uint_least8_t = uchar
|
172
|
+
rbx.platform.typedef.uintmax_t = ulong
|
122
173
|
rbx.platform.typedef.uintptr_t = ulong
|
123
|
-
rbx.platform.typedef.ulong = ulong
|
124
|
-
rbx.platform.typedef.unchar = uchar
|
125
174
|
rbx.platform.typedef.useconds_t = uint
|
126
175
|
rbx.platform.typedef.ushort = ushort
|
127
|
-
rbx.platform.typedef.
|
128
|
-
rbx.platform.typedef.
|
176
|
+
rbx.platform.typedef.vm_offset_t = ulong
|
177
|
+
rbx.platform.typedef.vm_ooffset_t = ulong
|
178
|
+
rbx.platform.typedef.vm_paddr_t = ulong
|
179
|
+
rbx.platform.typedef.vm_pindex_t = ulong
|
180
|
+
rbx.platform.typedef.vm_size_t = ulong
|
181
|
+
rbx.platform.typedef.wchar_t = uint
|
@@ -0,0 +1,100 @@
|
|
1
|
+
rbx.platform.typedef.*__caddr_t = char
|
2
|
+
rbx.platform.typedef.*__qaddr_t = long
|
3
|
+
rbx.platform.typedef.__blkcnt64_t = long
|
4
|
+
rbx.platform.typedef.__blkcnt_t = long
|
5
|
+
rbx.platform.typedef.__blksize_t = long
|
6
|
+
rbx.platform.typedef.__clock_t = long
|
7
|
+
rbx.platform.typedef.__clockid_t = int
|
8
|
+
rbx.platform.typedef.__daddr_t = int
|
9
|
+
rbx.platform.typedef.__dev_t = ulong
|
10
|
+
rbx.platform.typedef.__fd_mask = long
|
11
|
+
rbx.platform.typedef.__fsblkcnt64_t = ulong
|
12
|
+
rbx.platform.typedef.__fsblkcnt_t = ulong
|
13
|
+
rbx.platform.typedef.__fsfilcnt64_t = ulong
|
14
|
+
rbx.platform.typedef.__fsfilcnt_t = ulong
|
15
|
+
rbx.platform.typedef.__gid_t = uint
|
16
|
+
rbx.platform.typedef.__id_t = uint
|
17
|
+
rbx.platform.typedef.__ino64_t = ulong
|
18
|
+
rbx.platform.typedef.__ino_t = ulong
|
19
|
+
rbx.platform.typedef.__int16_t = short
|
20
|
+
rbx.platform.typedef.__int32_t = int
|
21
|
+
rbx.platform.typedef.__int64_t = long
|
22
|
+
rbx.platform.typedef.__int8_t = char
|
23
|
+
rbx.platform.typedef.__intptr_t = long
|
24
|
+
rbx.platform.typedef.__key_t = int
|
25
|
+
rbx.platform.typedef.__loff_t = long
|
26
|
+
rbx.platform.typedef.__mode_t = uint
|
27
|
+
rbx.platform.typedef.__nlink_t = ulong
|
28
|
+
rbx.platform.typedef.__off64_t = long
|
29
|
+
rbx.platform.typedef.__off_t = long
|
30
|
+
rbx.platform.typedef.__pid_t = int
|
31
|
+
rbx.platform.typedef.__priority_which_t = int
|
32
|
+
rbx.platform.typedef.__quad_t = long
|
33
|
+
rbx.platform.typedef.__rlim64_t = ulong
|
34
|
+
rbx.platform.typedef.__rlim_t = ulong
|
35
|
+
rbx.platform.typedef.__rlimit_resource_t = int
|
36
|
+
rbx.platform.typedef.__rusage_who_t = int
|
37
|
+
rbx.platform.typedef.__sig_atomic_t = int
|
38
|
+
rbx.platform.typedef.__socklen_t = uint
|
39
|
+
rbx.platform.typedef.__ssize_t = long
|
40
|
+
rbx.platform.typedef.__suseconds_t = long
|
41
|
+
rbx.platform.typedef.__swblk_t = long
|
42
|
+
rbx.platform.typedef.__time_t = long
|
43
|
+
rbx.platform.typedef.__timer_t = pointer
|
44
|
+
rbx.platform.typedef.__u_char = uchar
|
45
|
+
rbx.platform.typedef.__u_int = uint
|
46
|
+
rbx.platform.typedef.__u_long = ulong
|
47
|
+
rbx.platform.typedef.__u_quad_t = ulong
|
48
|
+
rbx.platform.typedef.__u_short = ushort
|
49
|
+
rbx.platform.typedef.__uid_t = uint
|
50
|
+
rbx.platform.typedef.__uint16_t = ushort
|
51
|
+
rbx.platform.typedef.__uint32_t = uint
|
52
|
+
rbx.platform.typedef.__uint64_t = ulong
|
53
|
+
rbx.platform.typedef.__uint8_t = uchar
|
54
|
+
rbx.platform.typedef.__useconds_t = uint
|
55
|
+
rbx.platform.typedef.blkcnt_t = long
|
56
|
+
rbx.platform.typedef.clockid_t = int
|
57
|
+
rbx.platform.typedef.daddr_t = int
|
58
|
+
rbx.platform.typedef.dev_t = ulong
|
59
|
+
rbx.platform.typedef.fd_mask = long
|
60
|
+
rbx.platform.typedef.fsblkcnt_t = ulong
|
61
|
+
rbx.platform.typedef.fsfilcnt_t = ulong
|
62
|
+
rbx.platform.typedef.gid_t = uint
|
63
|
+
rbx.platform.typedef.id_t = uint
|
64
|
+
rbx.platform.typedef.ino_t = ulong
|
65
|
+
rbx.platform.typedef.int16_t = short
|
66
|
+
rbx.platform.typedef.int32_t = int
|
67
|
+
rbx.platform.typedef.int64_t = long
|
68
|
+
rbx.platform.typedef.int8_t = char
|
69
|
+
rbx.platform.typedef.key_t = int
|
70
|
+
rbx.platform.typedef.loff_t = long
|
71
|
+
rbx.platform.typedef.mode_t = uint
|
72
|
+
rbx.platform.typedef.nlink_t = ulong
|
73
|
+
rbx.platform.typedef.off_t = long
|
74
|
+
rbx.platform.typedef.pid_t = int
|
75
|
+
rbx.platform.typedef.pthread_key_t = uint
|
76
|
+
rbx.platform.typedef.pthread_once_t = int
|
77
|
+
rbx.platform.typedef.pthread_t = ulong
|
78
|
+
rbx.platform.typedef.quad_t = long
|
79
|
+
rbx.platform.typedef.register_t = long
|
80
|
+
rbx.platform.typedef.rlim_t = ulong
|
81
|
+
rbx.platform.typedef.sa_family_t = ushort
|
82
|
+
rbx.platform.typedef.size_t = ulong
|
83
|
+
rbx.platform.typedef.socklen_t = uint
|
84
|
+
rbx.platform.typedef.ssize_t = long
|
85
|
+
rbx.platform.typedef.suseconds_t = long
|
86
|
+
rbx.platform.typedef.time_t = long
|
87
|
+
rbx.platform.typedef.timer_t = pointer
|
88
|
+
rbx.platform.typedef.u_char = uchar
|
89
|
+
rbx.platform.typedef.u_int = uint
|
90
|
+
rbx.platform.typedef.u_int16_t = ushort
|
91
|
+
rbx.platform.typedef.u_int32_t = uint
|
92
|
+
rbx.platform.typedef.u_int64_t = ulong
|
93
|
+
rbx.platform.typedef.u_int8_t = uchar
|
94
|
+
rbx.platform.typedef.u_long = ulong
|
95
|
+
rbx.platform.typedef.u_quad_t = ulong
|
96
|
+
rbx.platform.typedef.u_short = ushort
|
97
|
+
rbx.platform.typedef.uid_t = uint
|
98
|
+
rbx.platform.typedef.uint = uint
|
99
|
+
rbx.platform.typedef.ulong = ulong
|
100
|
+
rbx.platform.typedef.ushort = ushort
|
@@ -0,0 +1,104 @@
|
|
1
|
+
rbx.platform.typedef.*__caddr_t = char
|
2
|
+
rbx.platform.typedef.*__qaddr_t = long
|
3
|
+
rbx.platform.typedef.__blkcnt64_t = long
|
4
|
+
rbx.platform.typedef.__blkcnt_t = long
|
5
|
+
rbx.platform.typedef.__blksize_t = int
|
6
|
+
rbx.platform.typedef.__clock_t = long
|
7
|
+
rbx.platform.typedef.__clockid_t = int
|
8
|
+
rbx.platform.typedef.__daddr_t = int
|
9
|
+
rbx.platform.typedef.__dev_t = ulong
|
10
|
+
rbx.platform.typedef.__fd_mask = long
|
11
|
+
rbx.platform.typedef.__fsblkcnt64_t = ulong
|
12
|
+
rbx.platform.typedef.__fsblkcnt_t = ulong
|
13
|
+
rbx.platform.typedef.__fsfilcnt64_t = ulong
|
14
|
+
rbx.platform.typedef.__fsfilcnt_t = ulong
|
15
|
+
rbx.platform.typedef.__fsword_t = long
|
16
|
+
rbx.platform.typedef.__gid_t = uint
|
17
|
+
rbx.platform.typedef.__id_t = uint
|
18
|
+
rbx.platform.typedef.__ino64_t = ulong
|
19
|
+
rbx.platform.typedef.__ino_t = ulong
|
20
|
+
rbx.platform.typedef.__int16_t = short
|
21
|
+
rbx.platform.typedef.__int32_t = int
|
22
|
+
rbx.platform.typedef.__int64_t = long
|
23
|
+
rbx.platform.typedef.__int8_t = char
|
24
|
+
rbx.platform.typedef.__intptr_t = long
|
25
|
+
rbx.platform.typedef.__key_t = int
|
26
|
+
rbx.platform.typedef.__loff_t = long
|
27
|
+
rbx.platform.typedef.__mode_t = uint
|
28
|
+
rbx.platform.typedef.__nlink_t = uint
|
29
|
+
rbx.platform.typedef.__off64_t = long
|
30
|
+
rbx.platform.typedef.__off_t = long
|
31
|
+
rbx.platform.typedef.__pid_t = int
|
32
|
+
rbx.platform.typedef.__priority_which_t = int
|
33
|
+
rbx.platform.typedef.__quad_t = long
|
34
|
+
rbx.platform.typedef.__rlim64_t = ulong
|
35
|
+
rbx.platform.typedef.__rlim_t = ulong
|
36
|
+
rbx.platform.typedef.__rlimit_resource_t = int
|
37
|
+
rbx.platform.typedef.__rusage_who_t = int
|
38
|
+
rbx.platform.typedef.__sig_atomic_t = int
|
39
|
+
rbx.platform.typedef.__socklen_t = uint
|
40
|
+
rbx.platform.typedef.__ssize_t = long
|
41
|
+
rbx.platform.typedef.__suseconds_t = long
|
42
|
+
rbx.platform.typedef.__syscall_slong_t = long
|
43
|
+
rbx.platform.typedef.__syscall_ulong_t = ulong
|
44
|
+
rbx.platform.typedef.__time_t = long
|
45
|
+
rbx.platform.typedef.__timer_t = pointer
|
46
|
+
rbx.platform.typedef.__u_char = uchar
|
47
|
+
rbx.platform.typedef.__u_int = uint
|
48
|
+
rbx.platform.typedef.__u_long = ulong
|
49
|
+
rbx.platform.typedef.__u_quad_t = ulong
|
50
|
+
rbx.platform.typedef.__u_short = ushort
|
51
|
+
rbx.platform.typedef.__uid_t = uint
|
52
|
+
rbx.platform.typedef.__uint16_t = ushort
|
53
|
+
rbx.platform.typedef.__uint32_t = uint
|
54
|
+
rbx.platform.typedef.__uint64_t = ulong
|
55
|
+
rbx.platform.typedef.__uint8_t = uchar
|
56
|
+
rbx.platform.typedef.__useconds_t = uint
|
57
|
+
rbx.platform.typedef.blkcnt_t = long
|
58
|
+
rbx.platform.typedef.blksize_t = int
|
59
|
+
rbx.platform.typedef.clock_t = long
|
60
|
+
rbx.platform.typedef.clockid_t = int
|
61
|
+
rbx.platform.typedef.daddr_t = int
|
62
|
+
rbx.platform.typedef.dev_t = ulong
|
63
|
+
rbx.platform.typedef.fd_mask = long
|
64
|
+
rbx.platform.typedef.fsblkcnt_t = ulong
|
65
|
+
rbx.platform.typedef.fsfilcnt_t = ulong
|
66
|
+
rbx.platform.typedef.gid_t = uint
|
67
|
+
rbx.platform.typedef.id_t = uint
|
68
|
+
rbx.platform.typedef.ino_t = ulong
|
69
|
+
rbx.platform.typedef.int16_t = short
|
70
|
+
rbx.platform.typedef.int32_t = int
|
71
|
+
rbx.platform.typedef.int64_t = long
|
72
|
+
rbx.platform.typedef.int8_t = char
|
73
|
+
rbx.platform.typedef.key_t = int
|
74
|
+
rbx.platform.typedef.loff_t = long
|
75
|
+
rbx.platform.typedef.mode_t = uint
|
76
|
+
rbx.platform.typedef.nlink_t = uint
|
77
|
+
rbx.platform.typedef.off_t = long
|
78
|
+
rbx.platform.typedef.pid_t = int
|
79
|
+
rbx.platform.typedef.pthread_key_t = uint
|
80
|
+
rbx.platform.typedef.pthread_once_t = int
|
81
|
+
rbx.platform.typedef.pthread_t = ulong
|
82
|
+
rbx.platform.typedef.quad_t = long
|
83
|
+
rbx.platform.typedef.register_t = long
|
84
|
+
rbx.platform.typedef.rlim_t = ulong
|
85
|
+
rbx.platform.typedef.sa_family_t = ushort
|
86
|
+
rbx.platform.typedef.size_t = ulong
|
87
|
+
rbx.platform.typedef.socklen_t = uint
|
88
|
+
rbx.platform.typedef.ssize_t = long
|
89
|
+
rbx.platform.typedef.suseconds_t = long
|
90
|
+
rbx.platform.typedef.time_t = long
|
91
|
+
rbx.platform.typedef.timer_t = pointer
|
92
|
+
rbx.platform.typedef.u_char = uchar
|
93
|
+
rbx.platform.typedef.u_int = uint
|
94
|
+
rbx.platform.typedef.u_int16_t = ushort
|
95
|
+
rbx.platform.typedef.u_int32_t = uint
|
96
|
+
rbx.platform.typedef.u_int64_t = ulong
|
97
|
+
rbx.platform.typedef.u_int8_t = uchar
|
98
|
+
rbx.platform.typedef.u_long = ulong
|
99
|
+
rbx.platform.typedef.u_quad_t = ulong
|
100
|
+
rbx.platform.typedef.u_short = ushort
|
101
|
+
rbx.platform.typedef.uid_t = uint
|
102
|
+
rbx.platform.typedef.uint = uint
|
103
|
+
rbx.platform.typedef.ulong = ulong
|
104
|
+
rbx.platform.typedef.ushort = ushort
|
@@ -124,7 +124,8 @@ module FFI
|
|
124
124
|
f.puts "\n\treturn 0;\n}"
|
125
125
|
f.flush
|
126
126
|
|
127
|
-
|
127
|
+
cc = ENV['CC'] || 'gcc'
|
128
|
+
output = `#{cc} #{options[:cppflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1`
|
128
129
|
|
129
130
|
unless $?.success? then
|
130
131
|
output = output.split("\n").map { |l| "\t#{l}" }.join "\n"
|
@@ -82,7 +82,8 @@ module FFI
|
|
82
82
|
f.puts "\n return 0;\n}"
|
83
83
|
f.flush
|
84
84
|
|
85
|
-
|
85
|
+
cc = ENV['CC'] || 'gcc'
|
86
|
+
output = `#{cc} #{options[:cppflags]} #{options[:cflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1`
|
86
87
|
|
87
88
|
unless $?.success? then
|
88
89
|
@found = false
|
data/lib/ffi/variadic.rb
CHANGED
@@ -32,15 +32,6 @@
|
|
32
32
|
|
33
33
|
module FFI
|
34
34
|
class VariadicInvoker
|
35
|
-
def init(arg_types, type_map)
|
36
|
-
@fixed = Array.new
|
37
|
-
@type_map = type_map
|
38
|
-
arg_types.each_with_index do |type, i|
|
39
|
-
@fixed << type unless type == Type::VARARGS
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
35
|
def call(*args, &block)
|
45
36
|
param_types = Array.new(@fixed)
|
46
37
|
param_values = Array.new
|
data/lib/ffi/version.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'bundler/gem_helper'
|
3
|
+
|
4
|
+
class FfiGemHelper < Bundler::GemHelper
|
5
|
+
attr_accessor :cross_platforms
|
6
|
+
|
7
|
+
def install
|
8
|
+
super
|
9
|
+
|
10
|
+
task "release:guard_clean" => ["release:update_history"]
|
11
|
+
|
12
|
+
task "release:update_history" do
|
13
|
+
update_history
|
14
|
+
end
|
15
|
+
|
16
|
+
task "release:rubygem_push" => ["gem:windows", "gem:java"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def hfile
|
20
|
+
"CHANGELOG.md"
|
21
|
+
end
|
22
|
+
|
23
|
+
def headline
|
24
|
+
'([^\w]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
|
25
|
+
end
|
26
|
+
|
27
|
+
def reldate
|
28
|
+
Time.now.strftime("%Y-%m-%d")
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_history
|
32
|
+
hin = File.read(hfile)
|
33
|
+
hout = hin.sub(/#{headline}/) do
|
34
|
+
raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version.to_s
|
35
|
+
$1 + $2 + $3 + reldate + $5
|
36
|
+
end
|
37
|
+
if hout != hin
|
38
|
+
Bundler.ui.confirm "Updating #{hfile} for release."
|
39
|
+
File.write(hfile, hout)
|
40
|
+
Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def tag_version
|
45
|
+
Bundler.ui.confirm "Tag release with annotation:"
|
46
|
+
m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
|
47
|
+
Bundler.ui.info(m[:annotation].gsub(/^/, " "))
|
48
|
+
IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
|
49
|
+
fd.write m[:annotation]
|
50
|
+
end
|
51
|
+
yield if block_given?
|
52
|
+
rescue
|
53
|
+
Bundler.ui.error "Untagging #{version_tag} due to error."
|
54
|
+
sh_with_code "git tag -d #{version_tag}"
|
55
|
+
raise
|
56
|
+
end
|
57
|
+
|
58
|
+
def rubygem_push(path)
|
59
|
+
cross_platforms.each do |ruby_platform|
|
60
|
+
super(path.gsub(/\.gem\z/, "-#{ruby_platform}.gem"))
|
61
|
+
end
|
62
|
+
super(path.gsub(/\.gem\z/, "-java.gem"))
|
63
|
+
super(path)
|
64
|
+
end
|
65
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wayne Meissner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -613,6 +613,8 @@ files:
|
|
613
613
|
- lib/ffi/platform/powerpc-linux/types.conf
|
614
614
|
- lib/ffi/platform/powerpc-openbsd/types.conf
|
615
615
|
- lib/ffi/platform/powerpc64-linux/types.conf
|
616
|
+
- lib/ffi/platform/powerpc64le-linux/types.conf
|
617
|
+
- lib/ffi/platform/riscv64-linux/types.conf
|
616
618
|
- lib/ffi/platform/s390-linux/types.conf
|
617
619
|
- lib/ffi/platform/s390x-linux/types.conf
|
618
620
|
- lib/ffi/platform/sparc-linux/types.conf
|
@@ -646,6 +648,7 @@ files:
|
|
646
648
|
- lib/ffi/union.rb
|
647
649
|
- lib/ffi/variadic.rb
|
648
650
|
- lib/ffi/version.rb
|
651
|
+
- rakelib/ffi_gem_helper.rb
|
649
652
|
- samples/getlogin.rb
|
650
653
|
- samples/getpid.rb
|
651
654
|
- samples/gettimeofday.rb
|
@@ -680,7 +683,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
680
683
|
- !ruby/object:Gem::Version
|
681
684
|
version: '0'
|
682
685
|
requirements: []
|
683
|
-
rubygems_version: 3.
|
686
|
+
rubygems_version: 3.2.3
|
684
687
|
signing_key:
|
685
688
|
specification_version: 4
|
686
689
|
summary: Ruby FFI
|