Hi list,
I'm playing with PicoLisp's 'native' functionality and
https://github.com/zeromq/zyre. Most everything works as expected. Trivial
example:
: (setq Node (native "libzyre.so" "zyre_new" 'N "Node"))
-> 9322320 # Node set to pointer
: (native "libzyre.so" "zyre_uuid" 'S Node)
-> "44536C1E..." # uuid string
Perfect. The trouble is with 'zyre_destroy'. The C function signature is,
void zyre_destroy (zyre_t **self_p)
In C code it would be called as,
zyre_t *node = zyre_new("node");
zyre_destroy(&node);
How would I do the same in PicoLisp (call 'native' with the equivalent of
'&node')? The obviously incorrect,
: (native "libzyre.so" "zyre_destroy" NIL Node)
segfaults. As does,
: (native [...] NIL (struct Node 'N))
and
: (native [...] NIL (car (struct Node '(N))))
I think I need to do *something* with 'struct', but everything I've tried
ends with a segfault.
Note: In the Zyre header file the only mention of 'zyre_t' is,
// Opaque class structures to allow forward references
typedef struct _zyre_t zyre_t;
so I'm not sure how to use 'struct' with it.
Thanks,
Erik