[nanomsg] Attention Binding Maintainers!

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Sun, 17 Mar 2013 08:43:01 +0100

Hi all,

To simplify the maintenance of the nanomsg language bindings, new nn_symbol() function was implemented that allows to iterate over all the constants exposed by nanomsg library and get their names and values in dynamic fashion. The goal is to prevent copy/pasting the list of constants (socket types, socket options, error codes etc.) to each bindings.

The above, of course, applies only to languages that allow for creating the variables dynamically. Compiled bindings (such as C++ binding or JNI) should still use C headers to get access to the constants.

Finally, given that version numbers are provided as symbols, nn_version() function was removed.

Comment: In addition to nanomsg-specific symols, nn_symbol() function returns error codes that may be returned from nn_* functions. While some of these error codes (e.g. EINVAL) may be already accessible from the destination language, the binding should make them accessible to the user because:

1. Some errors are nanomsg-specific (EFSM, ETERM)
2. On some platforms (Win32) some of the POSIX error codes are not defined. These are then defined by nanomsg library and exported via
nn_symbol() function.

Martin

Other related posts: