[nanomsg] Re: RFC: Error code query API

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: <nanomsg@xxxxxxxxxxxxx>
  • Date: Thu, 14 Mar 2013 13:29:21 +0100

On 2013-03-14 13:21, Charles Remes wrote:
I like Martin's idea about the library providing a list of all known
symbols.

Ok. So Ruby binding would be able to take advantage of the function and avoid copy-pasting all symbols from the header file to the binding source code. Right?

Wouldn't the API for such a thing be simpler if it returned
an array of char* containing all of the symbol names? A binding could
create all of its local constants from this list and use
nn_symbol(name) to look up the associated integer code too.

e.g.

void nn_symbols(char **list, int *length)

From the C point of view this is the easiest option. I've proposed an alternative function (iterating over symbols) because I wasn't sure whether FFI subsystems in different language are able to handle variable-sized arrays of strings. It's quite a complex type, after all.

Martin

Other related posts: