Out parameters in the C FFI
(Sorry if this basic question has been answered before; didn't find in the list archives, wiki or manual.) What's the general approach for wrapping C functions like this: int foo(struct bar **out); So the foo function sets *out to some value of type "struct bar *", and we want to keep that "struct bar *" in Scheme and pass it around to other FFI functions. If it's not necessary to preserve the "int" return value then this can be worked around by writing a wrapper function in C: struct bar *my_foo_wrapper(void) { struct bar *bar; foo(&bar); return bar; } But is there a more general way to get values from out parameters into Scheme?
Afficher les réponses par date
participants (1)
-
Lassi Kortela