pedro on Nostr: #rustaceans, if I want to have a function in my program called from another lib ...
#rustaceans, if I want to have a function in my program called from another lib (which I control), e.g. `entry()` calls `main()`, am I constrained to use `extern {}` or is there another way to do it? I'm asking because I'd like to use type parameters, but the compiler won't (rightfully) let me use them in FFI functions. I know that I could probably get the same result with macros, but I was wondering if there's a cleaner way. #rust #rustlang
Published at
2024-07-22 07:15:03Event JSON
{
"id": "e18464508e447ac12fe6b0029a77738cd91a1ce688f75f791d592ddd8560455b",
"pubkey": "5e8eeccc48525fe24fcd353260fab01aae80311d83a900e8461696ee2f86200a",
"created_at": 1721632503,
"kind": 1,
"tags": [
[
"t",
"rustaceans"
],
[
"t",
"rust"
],
[
"t",
"rustlang"
],
[
"proxy",
"https://fedi.turbofish.cc/users/ubik/statuses/112828907735987926",
"activitypub"
]
],
"content": "#rustaceans, if I want to have a function in my program called from another lib (which I control), e.g. `entry()` calls `main()`, am I constrained to use `extern {}` or is there another way to do it? I'm asking because I'd like to use type parameters, but the compiler won't (rightfully) let me use them in FFI functions. I know that I could probably get the same result with macros, but I was wondering if there's a cleaner way. #rust #rustlang",
"sig": "737376f9e9a3398e2d477e2aa8495daac1650cdf1677b5b798015631ec979f2fb12e49115da0f5b9c171d7c32e2910d8e5fbbeac59bfad03527716723951eab7"
}