Richard W.M. Jones wrote: > From: "Richard W.M. Jones" <rjo...@redhat.com> > > http://gcc.gnu.org/wiki/Visibility > --- > configure.ac | 6 ++++ > generator/generator_c.ml | 70 ++++++++++++++++++++++++--------------------- > src/Makefile.am | 8 +++-- > 3 files changed, 48 insertions(+), 36 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 6e42423..368346f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -166,6 +166,12 @@ VERSION_SCRIPT_FLAGS=-Wl,--version-script= > VERSION_SCRIPT_FLAGS="-Wl,-M -Wl," > AC_SUBST(VERSION_SCRIPT_FLAGS) > > +dnl Use -fvisibility=hidden by default in the library. > +dnl http://gcc.gnu.org/wiki/Visibility > +AS_IF([test -n "$GCC"], > + [AC_SUBST([GCC_VISIBILITY_HIDDEN], [-fvisibility=hidden])], > + [AC_SUBST([GCC_VISIBILITY_HIDDEN], [:])])
You can simplify that slightly via: test -n "$GCC" && v=-fvisibility=hidden || v=: AC_SUBST([GCC_VISIBILITY_HIDDEN], [$v]) > -extern void guestfs_set_error_handler (guestfs_h *g, > guestfs_error_handler_cb cb, void *opaque); > -extern guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g, > void **opaque_rtn); > +extern GUESTFS_DLL_PUBLIC void guestfs_set_error_handler (guestfs_h *g, > guestfs_error_handler_cb cb, void *opaque); > +extern GUESTFS_DLL_PUBLIC guestfs_error_handler_cb guestfs_get_error_handler > (guestfs_h *g, void **opaque_rtn); The rest looks fine, modulo some longer-than-80-column lines. > -extern void guestfs_set_out_of_memory_handler (guestfs_h *g, > guestfs_abort_cb); > -extern guestfs_abort_cb guestfs_get_out_of_memory_handler (guestfs_h *g); > +extern GUESTFS_DLL_PUBLIC void guestfs_set_out_of_memory_handler (guestfs_h > *g, guestfs_abort_cb); > +extern GUESTFS_DLL_PUBLIC guestfs_abort_cb guestfs_get_out_of_memory_handler > (guestfs_h *g); > > /* Events. */ > "; ... > diff --git a/src/Makefile.am b/src/Makefile.am > index 28a1b92..b91ffc1 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -55,7 +55,8 @@ lib_LTLIBRARIES = libguestfs.la > # This convenience library is solely to compile its generated sources with > # custom flags. > libprotocol_la_SOURCES = guestfs_protocol.c guestfs_protocol.h > -libprotocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing > +libprotocol_la_CFLAGS = \ > + -Wall -Wno-unused -fno-strict-aliasing $(GCC_VISIBILITY_HIDDEN) I'm curious why you're not using $(WARN_CFLAGS) $(WERROR_CFLAGS) here. > # Build the errnostring perfect hash code. The generated code has lots > # of warnings so we must compile it in a separate mini-library. > @@ -63,7 +64,7 @@ liberrnostring_la_SOURCES = \ > errnostring_gperf.c \ > errnostring.h \ > errnostring.c > -liberrnostring_la_CFLAGS = > +liberrnostring_la_CFLAGS = $(GCC_VISIBILITY_HIDDEN) And here. > errnostring_gperf.c: errnostring_gperf.gperf > rm -f $@ > @@ -163,7 +164,8 @@ libguestfs_la_CFLAGS = \ > -DGUESTFS_WARN_DEPRECATED=1 \ > $(HIVEX_CFLAGS) $(AUGEAS_CFLAGS) $(PCRE_CFLAGS) \ > $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \ > - $(WARN_CFLAGS) $(WERROR_CFLAGS) > + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ > + $(GCC_VISIBILITY_HIDDEN) _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs