can pass a Utf8Buffer
# development
w
can pass a Utf8Buffer
...maybe not called that. sec.
h
so not a normal python
str
w
can also do that. multiple options.
actually: one is mostly for returning from an extern
h
so if I invoke a FFI funciton with an arg of
*const raw::c_char
, and pass a normal python string in that position, the FFI lib will make sure I don't do something wierd with memory?
w
because if you return a
*const raw::c_char
, it will be garbage collected before it hits the rust code
yes, that is correct.
h
ok cool
w
so yea.
*const raw::c_char
is fine as an argument, because the caller still has it on their stack
you need to copy it, because you don't own it.
but other than that, good.
but the alternative you've seen a few places is passing in a
Value
, and then using
externs
to get things.
h
ah yeah I guess a python string is also a
Value
w
and that works as well, and generally uses the
externs::*Buffer
types'
well, it is if you make it one.
Value ~= "cffi handle" (search for "handle" in that page)