-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closures cannot accept arguments of TYPE_CONST_STRING #62
Comments
Could you show a Ruby script that reproduces this case? |
Sure. test.rb: require 'fiddle'
require 'fiddle/import'
module MyModule
extend Fiddle::Importer
MyType = struct [
%q{void (*foo)(const char *value)}
]
end
closure = Class.new(Fiddle::Closure) {
def call(value)
puts "value! #{value}"
end
}.new(Fiddle::TYPE_VOID, [Fiddle::TYPE_CONST_STRING])
my_type = MyModule::MyType.malloc
my_type.foo = closure
# ...
fn = Fiddle::Function.new my_type.foo, [Fiddle::TYPE_CONST_STRING], Fiddle::TYPE_VOID
fn.call "bar" Then:
It seems like the behavior is specific to when closures are wrapped in a |
Thanks. |
Thanks @kou! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When attempting to invoke a closure with an argument of
Fiddle::TYPE_CONST_STRING
, I get this error:That's coming from here:
fiddle/ext/fiddle/closure.c
Line 134 in 03e7513
It appears that the
switch
inwith_gvl_callback()
doesn't handleTYPE_CONST_STRING
.The text was updated successfully, but these errors were encountered: