<Hunar>
Hello :) I haven't used the symbol @ before to get rid of temporary variables ... in the following code @ gives NIL instead of the result of the previous expression.. what is my problem
<Hunar>
Weird, if I call this function two times it crashes
<Regenaxer>
ah
<Regenaxer>
(tmp "name") is not a good idea
<Regenaxer>
it creates a *new* transient symbol each time
<Hunar>
I'll fix it now
<Regenaxer>
'native' wants to keep the pointer in the value
<Regenaxer>
But I would not expect a crash
<Regenaxer>
just slower execution because the lib is re-opened each time
<Regenaxer>
Perhaps some leak?
<Regenaxer>
opening the handle too often?
<Hunar>
I don't know :/ here is the relevant code http://ix.io/3HG5 I'm trying to solve the structs that were returned by value
<Hunar>
If I didn't free the pointer then it doesn't crash, but I'll have a memory leak
<Regenaxer>
You free the function pointer
<Regenaxer>
%@ "free" NIL "PilGetMousePosition")
<Regenaxer>
this calls it (native Lib "PilGetMousePosition")
<Regenaxer>
I don't quite get it, but I would not malloc() in the callee
<Regenaxer>
Better do it in Lisp
<Regenaxer>
using 'buf'
<Hunar>
bbl
<Regenaxer>
Do you know sizeof(Vector2)?
<Regenaxer>
ok
schulze has joined #picolisp
<Hunar>
I found the problem :) I copied the code from your solution (Wait, this is better: http://ix.io/3GeQ) But I only now noticed that its '"printf" instead of "printf" that was my error
<Hunar>
using a quote doesn't cause crash
<Regenaxer>
ok, but still I would use 'buf'
<Regenaxer>
much more efficient, and no 'free' is needed
<Hunar>
Ah, I was about to ask that :) I don't like using free
<Hunar>
I'll try that then
<Regenaxer>
good
<Regenaxer>
also because (%@ "free" NIL "PilGetMousePosition") is strange, right?
<Regenaxer>
"PilGetMousePosition" is the function handle
<Regenaxer>
not the malloc'ed memory
<Hunar>
T
<Hunar>
Does (%@ "free" ...) know how many bytes to free?
schulze has quit [Quit: nyaa~]
schulze has joined #picolisp
<Regenaxer>
yes
<Regenaxer>
The heap is maintained by linked structures