<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/ext/fiddle/lib, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/fiddle] Use Ruby's true/false for C bool</title>
<updated>2023-11-08T00:25:44+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2023-10-27T21:11:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2a6d6d3d65de43635a5f6ad38dbca170f1e40119'/>
<id>2a6d6d3d65de43635a5f6ad38dbca170f1e40119</id>
<content type='text'>
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

https://github.com/ruby/fiddle/commit/2640e0148e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

https://github.com/ruby/fiddle/commit/2640e0148e
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Add support for bool</title>
<updated>2023-08-02T09:17:18+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2023-07-03T07:43:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=15e8cf7ad95f5ea9ec95783e85a9ac5943f020f4'/>
<id>15e8cf7ad95f5ea9ec95783e85a9ac5943f020f4</id>
<content type='text'>
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

https://github.com/ruby/fiddle/commit/bc6c66bbb9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

https://github.com/ruby/fiddle/commit/bc6c66bbb9
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Add support for more "short" variants</title>
<updated>2023-06-28T07:36:50+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2023-05-24T07:50:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=731d27729b62ca6ceb1f1dc74985cdb9a0478b50'/>
<id>731d27729b62ca6ceb1f1dc74985cdb9a0478b50</id>
<content type='text'>
https://github.com/ruby/fiddle/commit/2b22bb9d74
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/fiddle/commit/2b22bb9d74
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Add support for "long" variants</title>
<updated>2023-06-28T07:36:50+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2023-05-24T07:38:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ebf14d01ba6c586e0ea6dd79ad19c5efa841d4c6'/>
<id>ebf14d01ba6c586e0ea6dd79ad19c5efa841d4c6</id>
<content type='text'>
GitHub: fix https://github.com/ruby/fiddle/pull/100

Reported by David M. Lary. Thanks!!!

https://github.com/ruby/fiddle/commit/516333dd78
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix https://github.com/ruby/fiddle/pull/100

Reported by David M. Lary. Thanks!!!

https://github.com/ruby/fiddle/commit/516333dd78
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Prefer String#unpack1 in Fiddle::ValueUtil</title>
<updated>2022-12-26T06:09:21+00:00</updated>
<author>
<name>Mau Magnaguagno</name>
<email>maumagnaguagno@gmail.com</email>
</author>
<published>2022-12-20T01:27:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8df574a492a70eb6161719c427deb55eb68c9c47'/>
<id>8df574a492a70eb6161719c427deb55eb68c9c47</id>
<content type='text'>
(https://github.com/ruby/fiddle/pull/118)

String#unpack1 is available since Ruby 2.4, and support for older than
Ruby 2.5 was dropped by #85.
Also simplified a common return statement.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(https://github.com/ruby/fiddle/pull/118)

String#unpack1 is available since Ruby 2.4, and support for older than
Ruby 2.5 was dropped by #85.
Also simplified a common return statement.
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Bump version</title>
<updated>2022-12-26T06:09:21+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2022-12-08T03:07:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1dc8c18b7270ca172fe301bd7f1db93fae6ae575'/>
<id>1dc8c18b7270ca172fe301bd7f1db93fae6ae575</id>
<content type='text'>
https://github.com/ruby/fiddle/commit/3033266902
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/fiddle/commit/3033266902
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Add support for linker script on Linux</title>
<updated>2022-10-18T08:21:45+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2022-04-10T23:32:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e84ea4af695de307c4e66bf0d9aa445a1016a4af'/>
<id>e84ea4af695de307c4e66bf0d9aa445a1016a4af</id>
<content type='text'>
GitHub: fix https://github.com/ruby/fiddle/pull/107

Reported by nicholas a. evans. Thanks!!!

https://github.com/ruby/fiddle/commit/49ea1490df
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix https://github.com/ruby/fiddle/pull/107

Reported by nicholas a. evans. Thanks!!!

https://github.com/ruby/fiddle/commit/49ea1490df
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Bump version</title>
<updated>2022-10-18T08:21:45+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2021-11-24T02:40:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=08ec6562822f0734f246741ebc9b0fa0829f8208'/>
<id>08ec6562822f0734f246741ebc9b0fa0829f8208</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Add Fiddle::Closure.create and Fiddle::Closure.free</title>
<updated>2022-10-07T06:18:51+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2022-09-14T03:59:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=255e617bc38f714c943c932e7df2b709313fd6bf'/>
<id>255e617bc38f714c943c932e7df2b709313fd6bf</id>
<content type='text'>
GitHub: fix GH-102

It's for freeing a closure explicitly.

We can't use Fiddle::Closure before we fork the process. If we do it,
the process may be crashed with SELinux.

See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091
for details.

Reported by Vít Ondruch. Thanks!!!

https://github.com/ruby/fiddle/commit/a0ccc6bb1b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GitHub: fix GH-102

It's for freeing a closure explicitly.

We can't use Fiddle::Closure before we fork the process. If we do it,
the process may be crashed with SELinux.

See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091
for details.

Reported by Vít Ondruch. Thanks!!!

https://github.com/ruby/fiddle/commit/a0ccc6bb1b
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Move "type" constants to `Fiddle::Types` (https://github.com/ruby/fiddle/pull/112)</title>
<updated>2022-10-07T06:18:50+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2022-09-13T15:26:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=755d99e8789b84a7d73d5a30f6b5d582e06f7f45'/>
<id>755d99e8789b84a7d73d5a30f6b5d582e06f7f45</id>
<content type='text'>
This helps to reduce repetition in code. Instead of doing "TYPE_*"
everywhere, you can do `include Fiddle::Types`, and write the type name
directly.

This PR is to help reduce repetition when writing Fiddle code. Right now
we have to type `TYPE_` everywhere, and you also have to include all of
`Fiddle` to access `TYPE_*` constants. With this change, you can just
include `Fiddle::Types` and it will shorten your code and also you only
have to include those constants.

Here is an example before:

```ruby
require "fiddle"

module MMAP
  # All Fiddle constants included
  include Fiddle

  def self.make_function name, args, ret
    ptr = Handle::DEFAULT[name]
    func = Function.new ptr, args, ret, name: name
    define_singleton_method name, &amp;func.to_proc
  end

  make_function "munmap", [TYPE_VOIDP, # addr
                           TYPE_SIZE_T], # len
                           TYPE_INT

  make_function "mmap", [TYPE_VOIDP,
                         TYPE_SIZE_T,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT], TYPE_VOIDP

  make_function "mprotect", [TYPE_VOIDP, TYPE_SIZE_T, TYPE_INT], TYPE_INT
end
```

After:

```ruby
require "fiddle"

module MMAP
  # Only type names included
  include Fiddle::Types

  def self.make_function name, args, ret
    ptr = Fiddle::Handle::DEFAULT[name]
    func = Fiddle::Function.new ptr, args, ret, name: name
    define_singleton_method name, &amp;func.to_proc
  end

  make_function "munmap", [VOIDP, # addr
                           SIZE_T], # len
                           INT

  make_function "mmap", [VOIDP, SIZE_T, INT, INT, INT, INT], VOIDP

  make_function "mprotect", [VOIDP, SIZE_T, INT], INT
end
```

We only need to import the type names, and you don't have to type
`TYPE_` over and over. I think this makes Fiddle code easier to read.

https://github.com/ruby/fiddle/commit/49fa7233e5

Co-authored-by: Sutou Kouhei &lt;kou@clear-code.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This helps to reduce repetition in code. Instead of doing "TYPE_*"
everywhere, you can do `include Fiddle::Types`, and write the type name
directly.

This PR is to help reduce repetition when writing Fiddle code. Right now
we have to type `TYPE_` everywhere, and you also have to include all of
`Fiddle` to access `TYPE_*` constants. With this change, you can just
include `Fiddle::Types` and it will shorten your code and also you only
have to include those constants.

Here is an example before:

```ruby
require "fiddle"

module MMAP
  # All Fiddle constants included
  include Fiddle

  def self.make_function name, args, ret
    ptr = Handle::DEFAULT[name]
    func = Function.new ptr, args, ret, name: name
    define_singleton_method name, &amp;func.to_proc
  end

  make_function "munmap", [TYPE_VOIDP, # addr
                           TYPE_SIZE_T], # len
                           TYPE_INT

  make_function "mmap", [TYPE_VOIDP,
                         TYPE_SIZE_T,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT], TYPE_VOIDP

  make_function "mprotect", [TYPE_VOIDP, TYPE_SIZE_T, TYPE_INT], TYPE_INT
end
```

After:

```ruby
require "fiddle"

module MMAP
  # Only type names included
  include Fiddle::Types

  def self.make_function name, args, ret
    ptr = Fiddle::Handle::DEFAULT[name]
    func = Fiddle::Function.new ptr, args, ret, name: name
    define_singleton_method name, &amp;func.to_proc
  end

  make_function "munmap", [VOIDP, # addr
                           SIZE_T], # len
                           INT

  make_function "mmap", [VOIDP, SIZE_T, INT, INT, INT, INT], VOIDP

  make_function "mprotect", [VOIDP, SIZE_T, INT], INT
end
```

We only need to import the type names, and you don't have to type
`TYPE_` over and over. I think this makes Fiddle code easier to read.

https://github.com/ruby/fiddle/commit/49fa7233e5

Co-authored-by: Sutou Kouhei &lt;kou@clear-code.com&gt;</pre>
</div>
</content>
</entry>
</feed>
