On Thu, Mar 24, 2016 at 11:54:59AM +0100, msuraev(a)sysmocom.de wrote:
This can be used with get_value_string() to improve
debugging output.
Great, but...
+static const struct value_string gsm_chan_t_names[] =
{
a static symbol can certainly not be used by get_value_string.
Oh, you put it in the header file, no that's not how we do things,
sorry. What you're doing means that every application that links the library
will end up having it's own copy of the data structures, somewhat defeating the
purpose of a shared library. Data structures like this have to go into a .c
file, and you need a forward-declaration in the header.
So either you
a) have the value_string non-static and exported in the symbol table, and
directly add a forward-declaration of the 'const struct value_string' array
like in th example of 'abis_nm_msg_disc_names' or
b) you have a static value_string array but an exported accessor functions and
those functions are forward-declared in the header (like your original patch)
theoretically, there could also be a 'c' where the accessor function is an
inline function or a macro, as it basicall is just a one-liner.
Sorry,
Harald
--
- Harald Welte <laforge(a)gnumonks.org>
http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)