| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
GitHub: fix https://github.com/ruby/fiddle/pull/107
Reported by nicholas a. evans. Thanks!!!
https://github.com/ruby/fiddle/commit/49ea1490df
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/105)
Fixes [Bug #18645]
https://github.com/ruby/fiddle/commit/9a5a1dab1d
|
|
|
|
|
|
|
|
|
| |
option. (#113)
https://bugs.ruby-lang.org/issues/18571
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
|
|
|
|
|
|
|
| |
GitHub: GH-102
They aren't available in ruby/ruby.
https://github.com/ruby/fiddle/commit/ced671e43b
|
|
|
|
|
|
| |
GitHub: GH-102
https://github.com/ruby/fiddle/commit/b2fef1770d
|
|
|
|
|
|
|
|
| |
GitHub: GH-102
This also improves freed closures assertions.
https://github.com/ruby/fiddle/commit/0495624caf
|
|
|
|
|
|
| |
It seems that we can't use it in ruby/ruby.
https://github.com/ruby/fiddle/commit/e1221297fb
|
|
|
|
|
|
|
|
| |
GitHub: GH-102
This also improves freed closures assertions.
https://github.com/ruby/fiddle/commit/f6431f3cf8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
test/fiddle/test_import.rb:138: warning:
ambiguous first argument; put parentheses or a space even after `-' operator
https://github.com/ruby/fiddle/commit/060eef76ad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/108)
I would like to check if a symbol is defined before trying to access it.
Some symbols aren't available on all platforms, so instead of raising an
exception, I want to check if it's defined first.
Today we have to do:
```ruby
begin
addr = Fiddle::Handle.sym("something")
# do something
rescue Fiddle::DLError
end
```
I want to write this:
```ruby
if Fiddle::Handle.sym_defined?("something")
addr = Fiddle::Handle.sym("something")
# do something
end
```
https://github.com/ruby/fiddle/commit/9d3371de13
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/112)
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, &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, &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 <kou@clear-code.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/111)
This commit adds constants for unsigned values. Currently we can use `-`
to mean "unsigned", but I think having a specific name makes Fiddle more
user friendly. This commit continues to support `-`, but introduces
negative constants with "unsigned" names
I think this will help to eliminate [this
code](https://github.com/ruby/ruby/blob/3a56bf0bcc66e14ffe5ec89efc32ecfceed180f4/lib/mjit/c_type.rb#L31-L38)
https://github.com/ruby/fiddle/commit/2bef0f1082
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GitHub: fix GH-102
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/1343ac7a95
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/110)
https://github.com/ruby/fiddle/commit/4a71246645ccff001292c9d80b855b2ef5bf06c1
|
|
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/e08c4c635e
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/91)
* Simplify libc_so and libm_so
If nil, no need to set to nil.
* Get rid of repeating inversions
https://github.com/ruby/fiddle/commit/4323e689d8
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/90)
I need to get the offset of members inside sub structures. This patch
adds sub-structure offset support for structs.
https://github.com/ruby/fiddle/commit/cf78eddbb6
|
| |
|
|
|
|
| |
Even when the path which was used to dlopen may be a symlink.
|
| |
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/88)
https://github.com/ruby/fiddle/commit/4ee1c6fc4b
|
|
|
|
|
|
| |
FIddle::Handle#to_ptr (https://github.com/ruby/fiddle/pull/87)
https://github.com/ruby/fiddle/commit/170111a0cb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/83)
* Add "offsetof" to Struct classes
I need to get the offset of a member inside a struct without allocating
the struct. This patch adds an "offsetof" class method to structs that
are generated.
The usage is like this:
```ruby
MyStruct = struct [
"int64_t i",
"char c",
]
MyStruct.offsetof("i") # => 0
MyStruct.offsetof("c") # => 8
```
* Update test/fiddle/test_c_struct_builder.rb
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
https://github.com/ruby/fiddle/commit/4e3b60c5b6
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/80)
fix https://github.com/ruby/fiddle/pull/79
Users can release memory views explicitly before process exit.
Reported by xtkoba. Thanks!!!
https://github.com/ruby/fiddle/commit/1de64b7e76
|
|
|
|
|
|
|
| |
(https://github.com/ruby/fiddle/pull/78)
Fix https://github.com/ruby/fiddle/pull/74
Reported by dsisnero. Thanks!!!
|
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/ca5e6a0404
|
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/fab7eab95b
|
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/c86cec03cd
|
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/1da3b4af16
|
|
|
|
|
|
|
|
|
| |
Ruby: [Bug #11579]
Patch by cremno phobia. Thanks!!!
https://github.com/ruby/fiddle/commit/760a8f9b14
|
| |
|
|
|
|
|
|
| |
Fixes [Bug #12666]
https://github.com/ruby/fiddle/commit/a267a40be7
|
|
|
|
|
|
|
|
| |
GitHub: fix #68
Reported by kojix2. Thanks!!!
https://github.com/ruby/fiddle/commit/d7322c234a
|
|
|
|
|
|
|
|
| |
GitHub: fix GH-62
Reported by Cody Krieger. Thanks!!!
https://github.com/ruby/fiddle/commit/284b820f2d
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/dc2da6633e
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This lets us cast a Fiddle::Function to a block, allowing is to write
things like:
```ruby
f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
define_method :strcpy, &f
```
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
I don't use tool/sync_default_gem.rb because the last sync was incomplete.
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: sinisterchipmunk <sinisterchipmunk@gmail.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
|
|
|
|
|
| |
This reverts commit bd47a8d660ab33a20c5e28d0effcc29105c434e4.
`libc_so` and `libm_so` are `nil` at line 124 because Big Sur doesn't have `/usr/lib/libSystem.B.dylib`.
The reassignment at line 127 is necessary in this case.
|
| |
|
|
|
|
| |
https://github.com/ruby/fiddle/commit/cf168680a2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
For example, :voidp equals to Fiddle::TYPE_VOID_P.
https://github.com/ruby/fiddle/commit/3b4de54899
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|