Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4636

Ruby/FFI: String not getting to *char function argument

$
0
0

I'm trying to implement with FFI a few functions from the Darknet library:

require 'ffi'class Image < FFI::Struct  layout :w, :int  layout :h, :int  layout :c, :int  layout :data, :pointerendclass Darknet  extend FFI::Library  ffi_lib "./libdarknet.so"  attach_function :load_image_color, [:string, :int, :int], Imageendimage = Darknet.load_image_color("./test.jpg", 0, 0)

It seems that the filename string doesn't get through:

Cannot load image "(null)"STB Reason: can't fopen

Here are the function and the declaration.

I'm quite new to FFI, but I've managed to implement other functions without any issue. I must be missing something obvious, if someone can give me pointers (no pun intended)...


Viewing all articles
Browse latest Browse all 4636

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>