<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/ext/fiddle/pointer.c, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Do not depend on the evaluation order of C arguments</title>
<updated>2024-12-03T20:43:08+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-11-29T04:28:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6adc69c41c6edb409c5306573511cd6d8b436fbe'/>
<id>6adc69c41c6edb409c5306573511cd6d8b436fbe</id>
<content type='text'>
The evaluation order of C arguments is unspecified.
`RSTRING_LEN(str)` would fails if the conversion to a String by
`StringValuePtr` is not done yet.

Coverity Scan found this issue.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The evaluation order of C arguments is unspecified.
`RSTRING_LEN(str)` would fails if the conversion to a String by
`StringValuePtr` is not done yet.

Coverity Scan found this issue.
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Ractor support</title>
<updated>2024-10-16T02:24:25+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-10-11T05:59:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bbd5b8ddae7b3ff7205866d54cf8aca065a6d9bd'/>
<id>bbd5b8ddae7b3ff7205866d54cf8aca065a6d9bd</id>
<content type='text'>
(https://github.com/ruby/fiddle/pull/139)

https://github.com/ruby/fiddle/commit/91d0ea9849

Co-authored-by: Sutou Kouhei &lt;kou@clear-code.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(https://github.com/ruby/fiddle/pull/139)

https://github.com/ruby/fiddle/commit/91d0ea9849

Co-authored-by: Sutou Kouhei &lt;kou@clear-code.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Cast via `VALUE` function pointer between object</title>
<updated>2024-10-10T14:52:07+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-10-10T05:16:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cd611becbbb31217575c2031682612d36f7a2fc4'/>
<id>cd611becbbb31217575c2031682612d36f7a2fc4</id>
<content type='text'>
pointer
(https://github.com/ruby/fiddle/pull/150)

With gcc 13 and -pedantic:

```
../../../src/ext/fiddle/function.c: In function ‘function_call’:
../../../src/ext/fiddle/function.c:374:15: error: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
  374 |     args.fn = (void(*)(void))NUM2PTR(cfunc);
      |               ^
../../../src/ext/fiddle/pointer.c: In function ‘rb_fiddle_ptr_inspect’:
../../../src/ext/fiddle/pointer.c:573:84: error: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
  573 |                       RB_OBJ_CLASSNAME(self), (void *)data, data-&gt;ptr, data-&gt;size, (void *)data-&gt;free);
      |                                                                                    ^
```

https://github.com/ruby/fiddle/commit/6421e317a1
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pointer
(https://github.com/ruby/fiddle/pull/150)

With gcc 13 and -pedantic:

```
../../../src/ext/fiddle/function.c: In function ‘function_call’:
../../../src/ext/fiddle/function.c:374:15: error: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
  374 |     args.fn = (void(*)(void))NUM2PTR(cfunc);
      |               ^
../../../src/ext/fiddle/pointer.c: In function ‘rb_fiddle_ptr_inspect’:
../../../src/ext/fiddle/pointer.c:573:84: error: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
  573 |                       RB_OBJ_CLASSNAME(self), (void *)data, data-&gt;ptr, data-&gt;size, (void *)data-&gt;free);
      |                                                                                    ^
```

https://github.com/ruby/fiddle/commit/6421e317a1
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Implement write barriers for Fiddle::Pointer</title>
<updated>2023-06-28T07:36:52+00:00</updated>
<author>
<name>Jean byroot Boussier</name>
<email>jean.boussier+github@shopify.com</email>
</author>
<published>2023-05-25T20:19:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=135d5fa36c29d98b999ab8128222d361a2e96779'/>
<id>135d5fa36c29d98b999ab8128222d361a2e96779</id>
<content type='text'>
(https://github.com/ruby/fiddle/pull/127)

Save from having to mark them on every minor.

https://github.com/ruby/fiddle/commit/153c09c99f

Co-authored-by: Jean Boussier &lt;jean.boussier@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(https://github.com/ruby/fiddle/pull/127)

Save from having to mark them on every minor.

https://github.com/ruby/fiddle/commit/153c09c99f

Co-authored-by: Jean Boussier &lt;jean.boussier@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Add a helper method for reading/writing memory</title>
<updated>2023-06-28T07:36:49+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2023-03-16T15:52:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=85937f3a0afeb7a2b3f9b8cb0dcaa8a20c49e09d'/>
<id>85937f3a0afeb7a2b3f9b8cb0dcaa8a20c49e09d</id>
<content type='text'>
(https://github.com/ruby/fiddle/pull/123)

This commit adds two new methods, `Fiddle::Pointer.read` and
`Fiddle::Pointer.write`. Both methods take an address, and will read or
write bytes at that address respectively.

For example we can read from an address without making a Pointer object:

```ruby
Fiddle::Pointer.read(address, 5) # read 5 bytes
```

We can also write to an address without allocating a Pointer object:

```ruby
Fiddle::Pointer.write(address, "bytes") # write 5 bytes
```

This allows us to read / write memory at arbitrary addresses without
instantiating a new `Fiddle::Pointer` object.

Examples where this API would be useful
[1](https://github.com/tenderlove/tenderjit/blob/f03481d28bff4d248746e596929b0841de65f181/lib/tenderjit/fiddle_hacks.rb#L26-L28)
[2](https://github.com/tenderlove/ruby/blob/77c8daa2d40dd58eeb3785ce17dea2ee38f308d1/lib/ruby_vm/rjit/c_pointer.rb#L193)
[3](https://github.com/tenderlove/ruby/blob/77c8daa2d40dd58eeb3785ce17dea2ee38f308d1/lib/ruby_vm/rjit/c_pointer.rb#L284)

I also added a writer method for the same reasons as the reader.

---------

https://github.com/ruby/fiddle/commit/04238cefed

Co-authored-by: Sutou Kouhei &lt;kou@clear-code.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(https://github.com/ruby/fiddle/pull/123)

This commit adds two new methods, `Fiddle::Pointer.read` and
`Fiddle::Pointer.write`. Both methods take an address, and will read or
write bytes at that address respectively.

For example we can read from an address without making a Pointer object:

```ruby
Fiddle::Pointer.read(address, 5) # read 5 bytes
```

We can also write to an address without allocating a Pointer object:

```ruby
Fiddle::Pointer.write(address, "bytes") # write 5 bytes
```

This allows us to read / write memory at arbitrary addresses without
instantiating a new `Fiddle::Pointer` object.

Examples where this API would be useful
[1](https://github.com/tenderlove/tenderjit/blob/f03481d28bff4d248746e596929b0841de65f181/lib/tenderjit/fiddle_hacks.rb#L26-L28)
[2](https://github.com/tenderlove/ruby/blob/77c8daa2d40dd58eeb3785ce17dea2ee38f308d1/lib/ruby_vm/rjit/c_pointer.rb#L193)
[3](https://github.com/tenderlove/ruby/blob/77c8daa2d40dd58eeb3785ce17dea2ee38f308d1/lib/ruby_vm/rjit/c_pointer.rb#L284)

I also added a writer method for the same reasons as the reader.

---------

https://github.com/ruby/fiddle/commit/04238cefed

Co-authored-by: Sutou Kouhei &lt;kou@clear-code.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86)</title>
<updated>2021-07-14T09:55:59+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-07-14T06:38:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=169529a0c0973fa925ad3b36f4427d31e802a37e'/>
<id>169529a0c0973fa925ad3b36f4427d31e802a37e</id>
<content type='text'>
https://github.com/ruby/fiddle/commit/c5abcc3a7e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/fiddle/commit/c5abcc3a7e
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Return the module handle value in Fiddle::Handle#to_i and add FIddle::Handle#to_ptr (https://github.com/ruby/fiddle/pull/87)</title>
<updated>2021-07-14T09:43:32+00:00</updated>
<author>
<name>Kenta Murata</name>
<email>mrkn@users.noreply.github.com</email>
</author>
<published>2021-07-14T02:26:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=818c74b7f4d5b88833af26226fc81e563b5d11b9'/>
<id>818c74b7f4d5b88833af26226fc81e563b5d11b9</id>
<content type='text'>
https://github.com/ruby/fiddle/commit/170111a0cb
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/fiddle/commit/170111a0cb
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] Use have_header and have_type to detect memory view availability</title>
<updated>2021-07-13T10:37:46+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2021-07-05T01:45:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bb868f4814c09c978f20f224c5e99656bc8b9bee'/>
<id>bb868f4814c09c978f20f224c5e99656bc8b9bee</id>
<content type='text'>
Fix https://github.com/ruby/fiddle/pull/84

It may detect ruby/memory_view.h for system Ruby that is installed in
/usr.

We can use RUBY_API_VERSION_MAJOR to detect memory view availability
because memory view is available since Ruby 3.0.

Reported by Jun Aruga. Thanks!!!

https://github.com/ruby/fiddle/commit/3292929830
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix https://github.com/ruby/fiddle/pull/84

It may detect ruby/memory_view.h for system Ruby that is installed in
/usr.

We can use RUBY_API_VERSION_MAJOR to detect memory view availability
because memory view is available since Ruby 3.0.

Reported by Jun Aruga. Thanks!!!

https://github.com/ruby/fiddle/commit/3292929830
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/fiddle] StringValuePtr may change the val</title>
<updated>2021-07-13T10:37:45+00:00</updated>
<author>
<name>Sutou Kouhei</name>
<email>kou@clear-code.com</email>
</author>
<published>2021-06-17T04:40:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9f86e50e1e03daff73a36fd8490f0457db98a641'/>
<id>9f86e50e1e03daff73a36fd8490f0457db98a641</id>
<content type='text'>
https://github.com/ruby/fiddle/commit/bddca7c895

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

</pre>
</div>
</content>
</entry>
<entry>
<title>[memory_view][fiddle] Use bool for boolean return value</title>
<updated>2020-12-23T00:05:07+00:00</updated>
<author>
<name>Kenta Murata</name>
<email>mrkn@mrkn.jp</email>
</author>
<published>2020-12-22T08:33:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=05014dcb887681d986105653ab527da2c4ff7774'/>
<id>05014dcb887681d986105653ab527da2c4ff7774</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
