ffi 1.16.2-x64-mingw-ucrt → 1.16.3-x64-mingw-ucrt

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb840bd2bc1a50f2fc2f07da6d613cc5840d2534f6838f8902114a05d9f2c1c
4
- data.tar.gz: 8b0b4d7174ca2e559581ad127d8b74f216d65ac45867ec596e4609259f113a65
3
+ metadata.gz: 54a712d7b4dc783be0f491d88bc6a5c5d1877e307f477ee100a1219a1b3b2d11
4
+ data.tar.gz: af5582f32367d3bf3c3bd8625aa01df9c7b9ede276b29a9b35b6b82d92d2af1c
5
5
  SHA512:
6
- metadata.gz: f2d1c8830fafa095c7bbe873a8e82991918a5a226fa5105bf88a2ffd9ef2590cda23c813ba886c2faf20299dc9050a20bf85d3d2a752b316b68309ff533d3577
7
- data.tar.gz: 584b638ad446f0e3262b2ec863162d8fc55f87ac5cd74679784df1f33913d3ed89cfb6ca75fdefb972e4c266f19b18eec73862f645f845ba43ba005951d26ad4
6
+ metadata.gz: 9b36cca116157f1680b7ea6fe74dfe6eed3ae6f2e2786cb6c7b6d49b5335af718e86683bc75122a6cfe40fa7d11bed5957637f91ed6f67a22e2cf1ba5e8d2515
7
+ data.tar.gz: b0ffe8b0911a84cf79a20502d190845267e48497898b77158e911e579709264dd7713ed38c2cd21e1842c658a19df8f1914e7125636242bd1795ec0762f54a72
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
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
+
1
9
  1.16.2 / 2023-09-25
2
10
  -------------------
3
11
 
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/3.1/ffi_c.so CHANGED
Binary file
data/lib/3.2/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.2'
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.2
4
+ version: 1.16.3
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Wayne Meissner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-25 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
@@ -177,9 +177,11 @@ files:
177
177
  - samples/getpid.rb
178
178
  - samples/gettimeofday.rb
179
179
  - samples/hello.rb
180
+ - samples/hello_ractor.rb
180
181
  - samples/inotify.rb
181
182
  - samples/pty.rb
182
183
  - samples/qsort.rb
184
+ - samples/qsort_ractor.rb
183
185
  homepage: https://github.com/ffi/ffi/wiki
184
186
  licenses:
185
187
  - BSD-3-Clause