aw- has quit [Quit: Leaving.]
aw- has joined #picolisp
ygrek has joined #picolisp
ygrek has quit [Remote host closed the connection]
rob_w has joined #picolisp
<
abu[7]>
Oh, I see! Rust needs 'extern "C" fn ..' declarations to be directly callable by PicoLisp :(
<
beneroth>
uh how annoying
<
abu[7]>
No idea if there is a build option
geri` has joined #picolisp
geri has quit [Read error: Connection reset by peer]
<
abu[7]>
ie. to (re)build the whole Veilid Rust library with C ABI
rob_w has quit [Remote host closed the connection]
<
abu[7]>
aw-: There is no generic way, right? The libraries have to be Witten that way.
geri`` has joined #picolisp
geri` has quit [Read error: Connection reset by peer]
<
aw->
no, if the function isn't extern'd then it will be for Rust only. There will be '#[repr(C)]' in the file if it's exposed as a C function
<
aw->
the C functions will be prefixed with: pub extern "C"
<
abu[7]>
like in your code
<
aw->
yeah.. anything that's not explicitly defined like that will not be accessible from picolisp
<
aw->
i browsed some o the Veilid code, it seems there's quite a few C functions in there
<
abu[7]>
So I'll have to manually change all a occurrences of the desired functions
<
abu[7]>
There is no global flag to compile
*all* as "C"?
<
abu[7]>
I can edit all .rs files containing "api_startup" for example
<
abu[7]>
The ".h" are used by .rs? Or are they for C code only?
<
abu[7]>
eg. veilid-core/src/tests/ios/veilidcore-tests/veilid-core.h
<
abu[7]>
Seems plain C
<
aw->
abu[7]: no you can't do that, not easily
<
abu[7]>
Just change api_startup() and test it?
<
aw->
because Rust has datatypes which don't exist in C
<
aw->
for example: i128
<
aw->
if the Rust code uses that, and you just change the function to extern as C, it will not compile
<
aw->
you would have to ensure every single datatype used is a valid C datatype
<
abu[7]>
api_startup is probably no problem
<
abu[7]>
For other functions we need glue functions
<
abu[7]>
pub extern "C" fn api_startup_C(..) -> .. {
<
abu[7]>
api_startup(..)
<
abu[7]>
Hmm, problem here is that the passed callback funs won't work either
<
abu[7]>
(opposite direction)
ygrek has joined #picolisp
ygrek has quit [Quit: Leaving]
ygrek has joined #picolisp
beneroth has quit [Read error: Connection reset by peer]
beneroth_ has joined #picolisp
beneroth_ has quit [Quit: Leaving]
rob_w has joined #picolisp