Skip to content
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

Error: undefined method 'to_unsafe' for Pointer(Void) #95

Open
christopherzimmerman opened this issue Nov 14, 2021 · 0 comments
Open

Error: undefined method 'to_unsafe' for Pointer(Void) #95

christopherzimmerman opened this issue Nov 14, 2021 · 0 comments

Comments

@christopherzimmerman
Copy link
Contributor

I am trying to bind to Apache Arrow using this library. Most methods work, except for methods that (in C), take GLib::Lists as arguments. The C-bindings that are generated are expecting Pointer(Pointer(Void)), while the GObject constructors are expecting Pointer(Void), and so when the pointer gets passed, to_unsafe fails.

Minimal example:

require "gobject"
require_gobject "Arrow"

f0 = Arrow::Field.new("int_field", Arrow::Int8DataType.new)
f1 = Arrow::Field.new("bool_field", Arrow::BooleanDataType.new)
puts f0.to_string
puts f1.to_string

schema = Arrow::Schema.new(Box.box([f0, f1]))

# > 18767 | 
# > 18768 |     def self.new(fields : Void*) : self
# > 18769 |       __var0 = LibArrow.schema_new(fields)
#                                              ^--------
# Error: undefined method 'to_unsafe' for Pointer(Void)

Here is the C function being called

I've tested out these methods using other language's GObject libraries, and it seems like these constructors accept the respective language's stdlib arrays where GLib::Lists are accepted.

I messed around a bit trying to update the return type for the TypeTag::GLIST, but didn't have any luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant