On Tue, 15 Sep 2020 14:26:48 +0100 Ben Hutchings <ben@xxxxxxxxxxxxxxx> wrote: > On Tue, 2020-09-15 at 16:12 +0300, Tzvetomir Stoyanov wrote: > > On Tue, Sep 15, 2020 at 12:29 AM Arnaldo Carvalho de Melo > > <arnaldo.melo@xxxxxxxxx> wrote: > > > Em Fri, Sep 11, 2020 at 03:08:16AM +0100, Ben Hutchings escreveu: > > > > I noticed that the new function tep_free_plugin_paths() is exported > > > > from libtraceevent, but is only declared in a private header file. > > > > Hi Ben, > > The tep_free_plugin_paths() function is supposed to be an internal > > function, not an API - that's why it is in a private header. What do you > > mean by "exported": the "tep_" prefix, or the fact that it is not static? > > It is exported from the shared library, i.e. it's included in the > library's dynamic symbols. That means that it could be called by a > program using the library, and would conflict with a function defined > by the program. Of course a program that uses this shouldn't have any tep_ prefix functions ;-) > > > I can remove the prefix, if that is what bothers you. > > No, exporting symbols without that prefix would make conflicts more > likely. Right! > > > The function is > > defined in event-plugin.c and is used in event-parse.c, that's why it > > cannot be made static without a library redesign. > > Yes, I realise that. However you can define it as "hidden": > <https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Common-Function-Attributes.html#index-visibility-function-attribute>. Ah, that's how libraries can hide non static functions. I learned something new today! Tzvetomir, Let's only have functions that are part of the library's API start with "tep_", and all other functions not have "tep_" in the name (so we know which ones are exported and which ones are not). Then any function that doesn't start with "tep_" should either be static, or hidden. #define __hidden __attribute__((visibility ("hidden"))) static void foo () { } void __hidden bar () { } -- Steve