automake+libtool+c++ = very bloated interface
Asked Answered
P

2

5

First i have "include_HEADERS = 'my public headers'" and "libfoobar_la_SOURCES = 'private sources' 'private headers'". All is fine. It compile/install/link. But when i do "nm -C my_instaed_lib.so" i get:

00005be0 T yyget_debug(void*)
00005b00 T yyget_extra(void*)
00005bf0 T yyset_debug(int, void*)
00005bb0 T yyset_extra(FM4::LexImpl*, void*)
00005b40 T yyget_column(void*)
00005b10 T yyget_lineno(void*)
00006180 T yyset_column(int, void*)
000061e0 T yyset_lineno(int, void*)
...

This never declared in any header.

000091f0 T FM4::PrcImpl::CollectMacro()
000089d0 T FM4::PrcImpl::CollectQuote()
00008870 T FM4::PrcImpl::CollectComment()
00009350 T FM4::PrcImpl::Collect()
000093f0 T FM4::PrcImpl::Process()
00008700 T FM4::PrcImpl::PrcImpl(FM4::Processor*)
00008590 T FM4::PrcImpl::PrcImpl(FM4::Processor*)
00009970 W FM4::PrcImpl::~PrcImpl()
00009a00 W FM4::PrcImpl::~PrcImpl()
...

This in private not installed header.

I read automake/libtool manual twice, but i don't know how strip this crap from interface? Or what can expose this crap to public api. How control what exported to public api?

Purtenance answered 13/2, 2011 at 0:24 Comment(2)
you do something with flex/lex?Schulze
Yes. Reentrant flex lexer but not declared in any header.Purtenance
H
8

Look for the libtool option -export-symbols. Give it a list of symbols that you want to export. By default, libtool exports all symbols.

Hereupon answered 13/2, 2011 at 6:12 Comment(0)
P
3

If you're adventurous, and can be sure that you're compiling with a new enough GCC (I think ≥4.2 is necessary for good support), visibility can help.

Restrict the default visibility (-fvisibility=hidden) and explicitly mark the functions you want to export with __attribute__((visibility("default"))).

Pantelegraph answered 13/2, 2011 at 10:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.