_whitelogger has joined #picolisp
ello has joined #picolisp
seninha has quit [Quit: Leaving]
<
tankf33der>
morning all
<
tankf33der>
garbage appears if function expects a struct, not pointer to struct in argument.
<
tankf33der>
is it possible to pass a struct? not a pointer to it
<
abu[7]>
Morning tankf33der!
<
abu[7]>
I see, did not notice that the function needs a structure, not a pointer!
<
abu[7]>
This is indeed not possible in pil native. We had this discussion here iirc, with hunar
<
tankf33der>
Then i will skipp this function, thanks a lot.
<
abu[7]>
Passing a struct in C means to copy it in total on the stack
<
abu[7]>
You could write a C glue function
<
tankf33der>
how it will look like?
<
abu[7]>
int myMono(crypto_argon2_config *config) {return mono(crypto_argon2_config config);}
<
tankf33der>
this way, ok.
<
abu[7]>
Disadvantage is that it needs a separate C lib, not just direct native calls
<
tankf33der>
So i will have mymono.so around
<
abu[7]>
not so nice
<
tankf33der>
Thanks a lot, i will play
<
abu[7]>
I wonder why some APIs do that, passing structs as a copy on tne stack
<
abu[7]>
It is very inefficient
<
abu[7]>
Standard POSIX libs never do that, AFAIK
rob_w has joined #picolisp
msavoritias has joined #picolisp
<
abu[7]>
Oops, my glue function above was wrong
<
abu[7]>
int myMono(crypto_argon2_config *config) {return mono(crypto_argon2_config *config);}
<
abu[7]>
you probably noticed
<
tankf33der>
my glue function:
<
abu[7]>
No need to copy. This would copy twice
<
abu[7]>
The problem
*is* already that passing structs by value copies them on the stack
<
abu[7]>
... *config);} dereferences the pointer, so I think this would work
<
tankf33der>
much better, thanks a lot.
seninha has joined #picolisp
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
<
tankf33der>
I have successfully binded several functions from monocypher library.
<
tankf33der>
abu[7]: thanks for support, i learnt new things.
rob_w has quit [Ping timeout: 246 seconds]
<
abu[7]>
Great tankf33der!
f8l has quit [Quit: WeeChat 3.0]
stux has quit [*.net *.split]
stux has joined #picolisp
msavoritias has quit [Remote host closed the connection]
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
seninha has quit [Quit: Leaving]