Yes, the Ruby binding would be able to take advantage of this. I hate all of that copy/paste work; it leads to stupid errors (on my part). cr On Mar 14, 2013, at 7:29 AM, Martin Sustrik <sustrik@xxxxxxxxxx> wrote: > 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 >