Open HoneyryderChuck opened 6 years ago
You need to allocate some memory for data not just pointers, like so:
verb = FFI::MemoryPointer.from_string("GET")
verb_len = FFI::MemoryPointer.new(:size_t)
verb_len.write(:size_t, verb.size-1)
header_reader = FFI::MemoryPointer.new(128)
header_reader_len = FFI::MemoryPointer.new(:int)
header_reader_len.write_int(128)
Hi, I'm trying to create an FFI binding for ruby. Unfortunately, haven't been able to progress in the most basic example, as I can't get the verb and path strings back. Since I'm a bit out of ideas on how to further debug it, came asking for advice. I've contained it in a small-purpose script:
@kazuho did you have some success using ffi in any other language? I've seen your perl parser and also @kazeburo 's ruby c-extension binding, but sadly neither could help get to the bottom of this. Some ruby-FFI-specific issue?