<p>I'm working a quick and dirty wrapper around co_obj_t and family... Just to get started.. Few obserbations:</p>

<p>I find unconfortable that  co_obj_t's "extended subtypes" have a different struct wrapper aroud them (with common elements)...<br>
I was thinking is wrapping all extension subtypes of co_obj_t in </p>

<p>typedef struct co_extobj_t {<br>
  co_obj_t _header;<br>
  uint8_t _exttype;<br>
  uint8_t _len;<br>
} co_extobj_t;</p>

<p>and then refactor all subtypes for it:<br>
i.e.<br>
struct co_iface_t {<br>
  co_extobj_t <em>header;<br>
...<br>
} __attribute_</em>((packed));</p>

<p>Nothing changes in the way data is layout, so it shouldn't have any impact, but this allows for easier constructs dealing generically with extended objects.</p>

<p>Then to the main issue:<br>
As with Wireshark an issue here is how to deal with the different lifespan of objects in the environment and in the language, so that garbage-collection on either side of the thing does not leave broken pointers on the other side.</p>

<p>I haven't studied the issue yet as currently I'm more involved with finding the "patterns" for the macros for adding easily the API to Lua .</p>

<p>My question is obj type _ptr already thought for ?<br>
It be so nice to use it for keeping references to an object, so that we can tell Lua the pointer is invalid when the other side deletes it.</p>

<p>\Lego</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/opentechinstitute/commotiond/issues/46#issuecomment-47738686">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/3074564__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxOTg5ODExMSwiZGF0YSI6eyJpZCI6MTgyNzY4MTd9fQ==--68ec2dce07265bf1144d4c5997b125039a780573.gif" width="1" /></p>