ffi 1.16.2-java → 1.16.3-java
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/ffi/types.rb +2 -1
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/qsort_ractor.rb +28 -0
- data.tar.gz.sig +3 -2
- metadata +4 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 403b38da3c452f3c1e3ec39766ca596f2d53e5b1424af3e8bc2f862ca2f72207
|
|
4
|
+
data.tar.gz: 96c88fe35bd5da21b3d96d708db99e481f935d91003998501d5e3638acad65ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62ac330100dfe633091c289dbf90c0219bb31111c7ef123b831ffd5411672d6d4e9ed7345a465003cf1a4ce87b6349e55bf1b81e967452c077dc7763e0b6c2b0
|
|
7
|
+
data.tar.gz: 06bef35a44ca4eedfc5042f5d962ac1b23d974f82b7f262701d7fc3213fa5cd5a93dfd4e80846ec4a71417509d7a7614bd73f8f9abe6a77f6aa68db0fecf34f8
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -15,7 +15,7 @@ using Ruby-FFI](https://github.com/ffi/ffi/wiki/why-use-ffi).
|
|
|
15
15
|
* C structs (also nested), enums and global variables
|
|
16
16
|
* Callbacks from C to Ruby
|
|
17
17
|
* Automatic garbage collection of native memory
|
|
18
|
-
* Usable in Ractor
|
|
18
|
+
* Usable in Ractor: [How-to-use-FFI-in-Ruby-Ractors](https://github.com/ffi/ffi/wiki/Ractors)
|
|
19
19
|
|
|
20
20
|
## Synopsis
|
|
21
21
|
|
data/lib/ffi/types.rb
CHANGED
|
@@ -87,7 +87,8 @@ module FFI
|
|
|
87
87
|
TypeDefs[name]
|
|
88
88
|
|
|
89
89
|
elsif name.is_a?(DataConverter)
|
|
90
|
-
(type_map ||
|
|
90
|
+
tm = (type_map || custom_typedefs)
|
|
91
|
+
tm[name] = Type::Mapped.new(name)
|
|
91
92
|
else
|
|
92
93
|
raise TypeError, "unable to resolve type '#{name}'"
|
|
93
94
|
end
|
data/lib/ffi/version.rb
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'ffi'
|
|
2
|
+
|
|
3
|
+
module LibC
|
|
4
|
+
extend FFI::Library
|
|
5
|
+
ffi_lib FFI::Library::LIBC
|
|
6
|
+
callback :qsort_cmp, [ :pointer, :pointer ], :int
|
|
7
|
+
attach_function :qsort, [ :pointer, :ulong, :ulong, :qsort_cmp ], :int
|
|
8
|
+
|
|
9
|
+
freeze # Freeze the module variables, so that it can be shared across ractors.
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
p = FFI::MemoryPointer.new(:int, 3)
|
|
13
|
+
p.put_array_of_int32(0, [ 2, 3, 1 ]) # Write some unsorted data into the memory
|
|
14
|
+
# Ractor.make_shareable(p) # freeze the pointer to be shared between ractors instead of copied
|
|
15
|
+
puts "main -ptr=#{p.inspect}"
|
|
16
|
+
res = Ractor.new(p) do |p|
|
|
17
|
+
puts "ractor-ptr=#{p.inspect}"
|
|
18
|
+
puts "Before qsort #{p.get_array_of_int32(0, 3).join(', ')}"
|
|
19
|
+
LibC.qsort(p, 3, 4) do |p1, p2|
|
|
20
|
+
i1 = p1.get_int32(0)
|
|
21
|
+
i2 = p2.get_int32(0)
|
|
22
|
+
puts "In block: comparing #{i1} and #{i2}"
|
|
23
|
+
i1 < i2 ? -1 : i1 > i2 ? 1 : 0
|
|
24
|
+
end
|
|
25
|
+
puts "After qsort #{p.get_array_of_int32(0, 3).join(', ')}"
|
|
26
|
+
end.take
|
|
27
|
+
|
|
28
|
+
puts "After ractor termination #{p.get_array_of_int32(0, 3).join(', ')}"
|
data.tar.gz.sig
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
-���+x��
|
|
2
|
+
���bj�ɫ%IT��Y~<#�J�S:�=��k"��P߿M�^o��WѬ��:~�F◩ԩ���)��\��Gl���q����t���8�sl"��%7���p��}�Ȓ����[��O�$lV�Y��]�q�/��*�?dˣ}���iy��j#�
|
|
3
|
+
�6�g���q�#=�9d)vR}�\;S��u��RZ{�]�Z�:��l��,�<=�\V~�:Mz�=��L������l�L���#�2���̕V�%Ƣ
|
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: 1.16.
|
|
4
|
+
version: 1.16.3
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Wayne Meissner
|
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
|
33
33
|
Dzx/gFSOrRoCt2mXNgrmcAfr386AfaMvCh7cXqdxZwmVo7ILZCYXck0pajvubsDd
|
|
34
34
|
NUIIFkVXvd1odFyK9LF1RFAtxn/iAmpx
|
|
35
35
|
-----END CERTIFICATE-----
|
|
36
|
-
date: 2023-
|
|
36
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
|
37
37
|
dependencies:
|
|
38
38
|
- !ruby/object:Gem::Dependency
|
|
39
39
|
name: rake
|
|
@@ -200,9 +200,11 @@ files:
|
|
|
200
200
|
- samples/getpid.rb
|
|
201
201
|
- samples/gettimeofday.rb
|
|
202
202
|
- samples/hello.rb
|
|
203
|
+
- samples/hello_ractor.rb
|
|
203
204
|
- samples/inotify.rb
|
|
204
205
|
- samples/pty.rb
|
|
205
206
|
- samples/qsort.rb
|
|
207
|
+
- samples/qsort_ractor.rb
|
|
206
208
|
homepage: https://github.com/ffi/ffi/wiki
|
|
207
209
|
licenses:
|
|
208
210
|
- BSD-3-Clause
|
metadata.gz.sig
CHANGED
|
Binary file
|