You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
char* could be encoded in multiple ways: UTF-8, ASCII, ... (I believe UTF-8 is the most common, but I've used ASCII before with C libs.)
char* could be null (0x0) terminated or there could be a length param. (I believe null-terminated is more common.)
The life-time and memory ownership of char* arguments is undocumented.
a. Does the callee take ownership and free it?
b. Or, can the caller free it immediately after the call returns? (I believe this to be the most common.)
c. Or, can the caller only free it after some other C function has been called?
The memory ownership of char* return values is undocumented
a. Does the caller take ownership and free it?
b. Does the callee free it after some other C function has been called (for example in SQLite when going to the next row in a query result).
A char* could be just a byte-array instead of a string.
Now, hopefully a single library, and single FFIgen invocation should make a consistent set of choices. However, if that's not the case we'll have to start using regex filters to apply certain behavior to certain C functions.
Right now, for a function like this in C:
ffigen
generates bindings like this:Requiring calling Dart code to look like so:
If instead,
ffigen
generated the following code:then using
ffigen
would become tremendously more straightforward.The text was updated successfully, but these errors were encountered: