Hi list,

I'm playing with PicoLisp's 'native' functionality and
https://github.com/zeromq/zyre. Most everything works as expected. Trivial

   : (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");


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))


   : (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.


Reply via email to