1NN_SYMBOL(3) nanomsg 1.1.5 NN_SYMBOL(3)
2
3
4
6 nn_symbol - query the names and values of nanomsg symbols
7
9 #include <nanomsg/nn.h>
10
11 const char *nn_symbol (int i, int *value);
12
14 Retrieves the symbol name and value at index i. Indices start at 0. An
15 index has no significance to its associated symbol; the mappings may
16 change between library versions.
17
18 Typically a client will iterate through the symbols until nn_symbol
19 returns NULL in order to collect all the symbols.
20
21 All symbols exposed by nn_symbol are available directly in the C API,
22 generally as preprocessor macros. Thus, this function is useful mostly
23 for language bindings that can’t parse the header file and rely on
24 retrieving the symbols in the runtime.
25
26 Note that the NN_MSG symbol is not exported by the nn_symbol function.
27 First, it is a pointer rather than an integer; second, the symbol is
28 not supposed to be exported from language bindings to the user.
29 Instead, language bindings should provide the zero-copy functionality
30 in a language-specific way, if at all (zero-copy functionality may not
31 make sense for some languages/bindings).
32
34 If i is valid, returns the name of the symbol at that index. If the
35 pointer value is not NULL, the symbol’s value is stored there.
36
37 If i is out-of-range, nn_symbol returns NULL and sets errno to EINVAL.
38
40 EINVAL
41 The passed index i was out-of-range; it was less than zero or
42 greater-than-or- equal-to the number of symbols.
43
45 int value, i;
46 for (i = 0; ; ++i) {
47 const char* name = nn_symbol (i, &value);
48 if (name == NULL) break;
49 printf ("'%s' = %d\n", name, value);
50 }
51
53 nn_symbol_info(3) nn_errno(3) nn_strerror(3) nanomsg(7)
54
56 Evan Wies <evan@neomantra.net>
57
58
59
60 2021-01-26 NN_SYMBOL(3)