Age | Commit message (Collapse) | Author |
|
* Add a "pinning" reference
A `Fiddle::Pinned` objects will prevent the objects they point to from
moving. This is useful in the case where you need to pass a reference
to a C extension that keeps the address in a global and needs the
address to be stable.
For example:
```ruby
class Foo
A = "hi" # this is an embedded string
some_c_function A # A might move!
end
```
If `A` moves, then the underlying string buffer may also move.
`Fiddle::Pinned` will prevent the object from moving:
```ruby
class Foo
A = "hi" # this is an embedded string
A_pinner = Fiddle::Pinned.new(A) # :nodoc:
some_c_function A # A can't move because of `Fiddle::Pinned`
end
```
This is a similar strategy to what Graal uses:
https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/PinnedObject.html#getObject--
* rename global to match exception name
* Introduce generic Fiddle::Error and rearrange error classes
Fiddle::Error is the generic exception base class for Fiddle exceptions.
This commit introduces the class and rearranges Fiddle exceptions to
inherit from it.
https://github.com/ruby/fiddle/commit/ac52d00223
Notes:
Merged: https://github.com/ruby/ruby/pull/3780
|
|
For example, :voidp equals to Fiddle::TYPE_VOID_P.
https://github.com/ruby/fiddle/commit/3b4de54899
Notes:
Merged: https://github.com/ruby/ruby/pull/3780
|
|
Add rb_fiddle_ prefix to conversion functions.h to keep backward
compatibility but value_to_generic() isn't safe for TYPE_CONST_STRING
and not String src. Use rb_fiddle_value_to_generic() instead.
https://github.com/ruby/fiddle/commit/0ffcaa39e5
Notes:
Merged: https://github.com/ruby/ruby/pull/3780
|
|
GitHub: fix GH-39
Reported by kojix2. Thanks!!!
https://github.com/ruby/fiddle/commit/6c4cb904dc
Notes:
Merged: https://github.com/ruby/ruby/pull/3265
|
|
[Feature #5458] Thanks to Jonan Scheffler <jonanscheffler@gmail.com>
for this patch
* test/dl/*: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
with DL.
* ext/fiddle/fiddle.h: ditto
* ext/fiddle/lib/fiddle/cparser.rb: importing the C parser for DL
backwards compatibility.
* ext/fiddle/lib/fiddle/import.rb: importing the import DSL for DL
backwards compatibility.
* ext/fiddle/lib/fiddle/pack.rb: importing structure pack for DL
backwards compatibility.
* ext/fiddle/lib/fiddle/value.rb: ditto
* ext/fiddle/lib/fiddle/struct.rb: importing struct DSL for DL backwards
compatibility.
* test/dl/test_c_struct_entry.rb: importing tests
* test/dl/test_c_union_entity.rb: ditto
* test/dl/test_cparser.rb: ditto
* test/dl/test_import.rb: ditto
* test/fiddle/test_c_struct_entry.rb: ditto
* test/fiddle/test_c_union_entity.rb: ditto
* test/fiddle/test_cparser.rb: ditto
* test/fiddle/test_import.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
to Fiddle::Handle.
* ext/fiddle/pointer.c: Make Fiddle independent of DL, copy
DL::Pointer to Fiddle::Pointer.
* test/fiddle/test_func.rb: relevent tests
* test/fiddle/test_handle.rb: ditto
* test/fiddle/test_pointer.rb: ditto
* ext/dl/lib/dl/struct.rb: use Fiddle::Pointer if available
* ext/fiddle/extconf.rb: check for dlfcn.h
* ext/fiddle/fiddle.c: add constants for sizeof() things
* ext/fiddle/fiddle.h: include dlfcn.h
* ext/fiddle/function.c: expose a C function for creating new
Fiddle::Function objects.
* ext/fiddle/lib/fiddle.rb: include constants for dl backwards compat
* ext/fiddle/lib/fiddle/function.rb: read the pointer from the
function for dl backwards compat.
* test/dl/test_callback.rb: check the addresses of the pointers rather
than their types.
* test/fiddle/helper.rb: remove dependency on dl
* test/fiddle/test_closure.rb: ditto
* test/fiddle/test_fiddle.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
to Fiddle::Handle.
* ext/fiddle/pointer.c: Make Fiddle independent of DL, copy
DL::Pointer to Fiddle::Pointer.
* test/fiddle/test_func.rb: relevent tests
* test/fiddle/test_handle.rb: ditto
* test/fiddle/test_pointer.rb: ditto
* ext/dl/lib/dl/struct.rb: use Fiddle::Pointer if available
* ext/fiddle/extconf.rb: check for dlfcn.h
* ext/fiddle/fiddle.c: add constants for sizeof() things
* ext/fiddle/fiddle.h: include dlfcn.h
* ext/fiddle/function.c: expose a C function for creating new
Fiddle::Function objects.
* ext/fiddle/lib/fiddle.rb: include constants for dl backwards compat
* ext/fiddle/lib/fiddle/function.rb: read the pointer from the
function for dl backwards compat.
* test/dl/test_callback.rb: check the addresses of the pointers rather
than their types.
* test/fiddle/helper.rb: remove dependency on dl
* test/fiddle/test_closure.rb: ditto
* test/fiddle/test_fiddle.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[ruby-core:42458][Bug #5991][Bug #6022]
* ext/fiddle/conversions.c (value_to_generic, generic_to_value):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[ruby-core:33977]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
header files. Thanks Yugui! [ruby-core:30917]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/fiddle/*: testing fiddle extension
* ext/dl/lib/dl.rb: Requiring fiddle if it is available
* ext/dl/lib/dl/callback.rb: using Fiddle if it is available
* ext/dl/lib/dl/func.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|