Hi Eric, Here's a link to exactly what you need:
https://github.com/michelp/0pl/blob/master/zmq/zctx.l#L5 There's a thread in the archives where Alexander explains it to me, unfortunately it's been a while I don't remember all the details myself... -Michel On Sun, Apr 2, 2017 at 10:00 AM, Erik Gustafson <erik.d.gustaf...@gmail.com> wrote: > 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 >