gudenau on Nostr: I'm going to guess that if I have a FFI function with the C prototype of `Status ...
I'm going to guess that if I have a FFI function with the C prototype of `Status list(Handle handle, Element* elements, size_t* count)` calling it as a Rust prototype of `unsafe extern "C" fn list(handle: Handle, elements: *mut Option<Element>, count: *mut usize) -> Status` is incorrect? I have a C impl of that that is setting 4 elements of a Rust allocated `Vec<Option<Element>>` and the second half are `None` for some reason.
I'm not sure what I am doing wrong.
Published at
2025-03-29 21:07:35 UTCEvent JSON
{
"id": "9a3ebbdaf247df201b0284f221c957b4acc2b6bf766db8d8b6d30d63bd5a85d5",
"pubkey": "db46a46e48fbb369dac7db115ec93ac88b3fd141eade8a6ba3e8e94e54ef0e9f",
"created_at": 1743282455,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/@gudenau/114247759023197594",
"web"
],
[
"content-warning",
"Rust, Screen Reader Unfriendly"
],
[
"proxy",
"https://fosstodon.org/users/gudenau/statuses/114247759023197594",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://fosstodon.org/users/gudenau/statuses/114247759023197594",
"pink.momostr"
],
[
"-"
]
],
"content": "I'm going to guess that if I have a FFI function with the C prototype of `Status list(Handle handle, Element* elements, size_t* count)` calling it as a Rust prototype of `unsafe extern \"C\" fn list(handle: Handle, elements: *mut Option\u003cElement\u003e, count: *mut usize) -\u003e Status` is incorrect? I have a C impl of that that is setting 4 elements of a Rust allocated `Vec\u003cOption\u003cElement\u003e\u003e` and the second half are `None` for some reason.\n\nI'm not sure what I am doing wrong.",
"sig": "780d4f2473f1665814ca579a8ed9977250081797ebe2e558990152024e113c48dd7777cce5ec183fdce76d75e71ed99509268ea8856f331835d5313023259d10"
}