<Regenaxer>
Cool! But your server works perfectly and efficient :)
<beneroth>
:)
<Nistur>
hulloooo
<Nistur>
I'm currently hurting my tired brain, trying to figure out how to do something with native... the thing I'm trying to call has one parameter which is a char* that it populates, and, trying to read the docs, my eyes get crossed trying to make sense of the spec :S
<Regenaxer>
Just one char* arg is simple
<Nistur>
'(Out (4 B . 4)) appears to be what one example says for, what would in C be char Out[4]; but I'm not sure what the other 4 is...
<Regenaxer>
(native "lib.so" "fun" 'I "abc") ?
<Nistur>
no, the C function populates it, I need it back after it's done
<Regenaxer>
ah, ok
<Regenaxer>
So you pass a structure
<Regenaxer>
So the 4 is just a fill byte
<Nistur>
the first or the last?
* Nistur
blink
<Regenaxer>
No, I'm wrong
<Nistur>
s
<Nistur>
also, not that it effects me right now, but in Return Value - Primitive Types, the examples has 'N as both 'long' and 'void*', is this correct?
<Regenaxer>
yes
<Regenaxer>
pointer and long numbers are expected to be 64 bits
<Nistur>
ok
<Nistur>
just checking :)
<Regenaxer>
So back to (4 B . 4)
<Regenaxer>
4 is the passed size, and the last 4 the size of the returned value
<Regenaxer>
eg I use this to get the time:
<Regenaxer>
(native "@" "time" NIL '(Tim (8 B . 8)))
<Regenaxer>
8 Bytes
<Regenaxer>
cons pair for the size and result
<Regenaxer>
spec
<Regenaxer>
oh, it is in the ref examples anyway ;)
<Nistur>
yeah, I've been trying to make sense of them, but I'm running on low sleep and it just wasn't getting through :P sorry
<Nistur>
urgh, I'm still getting a segfault, so that wasn't it
<Regenaxer>
Are 4 bytes enough?
<Nistur>
I'm trying to wrap libssl.so to do some RSA. I have seen rsa.l but it doesn't appear to do everything I need, and does it in a slightly strange way (key length in digits, rather than bits for example) and, as I'd like this to be compatible with non-pil clients eventually I kind of wanted 'standard'...
<Nistur>
so I was trying to call RSA_public_encrypt, the input was 24 bytes, and I set the output to 4096 just to be safe
<Nistur>
make it ridiculously large, then size shouldn't be a problem :P
<Regenaxer>
So (Out (4096 B . 4096)) ?
<Nistur>
the 4 byte was from the example, that's why I was trying to figure out what the two 4s were, so I'd no what to change
<Regenaxer>
ok
<Regenaxer>
But if you need input in the buffer, you must use 'struct' to fill it
<Nistur>
(native *LibSSL "RSA_public_encrypt" 'I len '(enc (4096 B . 4096)) key rsa:PKCS1-padding)
<Regenaxer>
or is the buffer not initialized?
<Nistur>
oh wait
<Nistur>
maybe I'm an idiot
<Regenaxer>
I don't think so :)
<Nistur>
nope, well yes, but it still errors
<Nistur>
len is (length data)
<Nistur>
which in this case is 24
<Nistur>
and I noticed that I hadn't added data to the parameters :P
<Nistur>
but it is now
<Nistur>
key is... um... supposedly an RSA* returned from... 2 other native calls
<Regenaxer>
I'd expect to use malloc and struct
<Regenaxer>
to fill the input data
<Regenaxer>
BTW, how is *LibSSL initialized?
<Nistur>
(setq *LibSSL "libssl.so")
<Nistur>
because I _will_ mistype it at least once otherwise
<Regenaxer>
then you need (native `*LibSSL
<Regenaxer>
native works best with a transient symbol
<beneroth>
transient = scoped to the file
<beneroth>
(source file)
<Regenaxer>
so that after the first call it evalates to the pointer
<Regenaxer>
yes
<beneroth>
hellooooo Regenaxer and Nistur :)
<beneroth>
glad to see you guys :)
<Regenaxer>
Hi beneroth!
<Regenaxer>
I was just going to prepare for sleep ;)
<Nistur>
:)
<Regenaxer>
(native "libssl.so" ... gets the symbol on first call
<Regenaxer>
and the pointer after that
<Nistur>
ok
<Regenaxer>
cause the symbol "libssl.so" is set to that value
<Nistur>
so my thing to avoid typos is bad :P got it
<Nistur>
I'll remove it
<Regenaxer>
(native *LibSSL get the symbol *each* call
<Regenaxer>
no
<Regenaxer>
use a read macro
<Regenaxer>
(native `*LibSSL
<Nistur>
ok
<Regenaxer>
see lib/openGl.l
<Regenaxer>
Your version works, but inefficient
<Regenaxer>
cause dlopen() is called each time
<Regenaxer>
Not the problem here :)
<Regenaxer>
Sorry, I'm tired ...
<Regenaxer>
and you too as I understood
<Regenaxer>
let's continue next time :)
<Regenaxer>
Good night! :)
<Nistur>
ok :_
<Nistur>
:)
<Nistur>
nighty night
<Regenaxer>
:)
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp
f8l has quit [Ping timeout: 258 seconds]
stultulo has joined #picolisp
stultulo has quit [Remote host closed the connection]