8000 Error: undefined method 'to_unsafe' for Pointer(Void) · Issue #95 · jhass/crystal-gobject · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Error: undefined method 'to_unsafe' for Pointer(Void) #95
Open
@christopherzimmerman

Description

@christopherzimmerman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0