ffi 1.16.1-x64-mingw32 → 1.16.3-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86ba5253e5a33bd415e7e9374ebc7820709b9897f5ed74646edb27dce441c7e0
4
- data.tar.gz: a1ce3b1cdf371b2b6eacca01ebced1e1ae65f53c3298b1f7de1f364fe6515116
3
+ metadata.gz: 061217eb6d09880fe69057abb7890b05b7e671ea76e38f6db5e5606cb322f2cb
4
+ data.tar.gz: aac6d918924b7b3a5dbcea7057bc95f8e755bd77db6e1b268d80d1053d674c26
5
5
  SHA512:
6
- metadata.gz: 8c184b7b8db27a654235bde5abd06c28e3cc4238c70a9d2dca27be8a4eb00520e79dc8239a19cae3a6732488f02da75e3e83c07a537719abba6761e462a95ed7
7
- data.tar.gz: 438dfe7e604531e4d032b4badc0b4092940f997ff72e568ab105d624f41438bd6e89fd8e00eb3db690d70792d8c8c352bfbaba98e3aa8c61c39ec88116f3ab03
6
+ metadata.gz: 7d383111fc2ea1e3f6e700df31906b43e7dec834bdf5b3cf12462028e5e165477dcd4a8a03917c844c1f877c6c50f28e4d00939e1023fa0dfefac4c9cb0793eb
7
+ data.tar.gz: '000884c2508da0e59183a031f2dddfe2f5d810359a8d632e55c04b9309684b480b9e87266a59a4d5127ceef351f30d8e9f79fd3ce87de2ece1279f022e1dac7b'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ 1.16.3 / 2023-10-04
2
+ -------------------
3
+
4
+ Fixed:
5
+ * Fix gcc error when building on CentOS 7. #1052
6
+ * Avoid trying to store new DataConverter type in frozen TypeDefs hash. #1057
7
+
8
+
9
+ 1.16.2 / 2023-09-25
10
+ -------------------
11
+
12
+ Fixed:
13
+ * Handle null pointer crash after fork. #1051
14
+
15
+
1
16
  1.16.1 / 2023-09-24
2
17
  -------------------
3
18
 
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/2.5/ffi_c.so CHANGED
Binary file
data/lib/2.6/ffi_c.so CHANGED
Binary file
data/lib/2.7/ffi_c.so CHANGED
Binary file
data/lib/3.0/ffi_c.so CHANGED
Binary file
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 || TypeDefs)[name] = Type::Mapped.new(name)
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
@@ -1,3 +1,3 @@
1
1
  module FFI
2
- VERSION = '1.16.1'
2
+ VERSION = '1.16.3'
3
3
  end
@@ -0,0 +1,11 @@
1
+ require 'ffi'
2
+
3
+ module Foo
4
+ extend FFI::Library
5
+ ffi_lib FFI::Library::LIBC
6
+ attach_function("cputs", "puts", [ :string ], :int)
7
+ freeze
8
+ end
9
+ Ractor.new do
10
+ Foo.cputs("Hello, World via libc puts using FFI in a Ractor")
11
+ end.take
@@ -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(', ')}"
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.16.1
4
+ version: 1.16.3
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Wayne Meissner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-24 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -179,9 +179,11 @@ files:
179
179
  - samples/getpid.rb
180
180
  - samples/gettimeofday.rb
181
181
  - samples/hello.rb
182
+ - samples/hello_ractor.rb
182
183
  - samples/inotify.rb
183
184
  - samples/pty.rb
184
185
  - samples/qsort.rb
186
+ - samples/qsort_ractor.rb
185
187
  homepage: https://github.com/ffi/ffi/wiki
186
188
  licenses:
187
189
  - BSD-3-Clause