Re: Segmentation fault using libtidy (symptoms, diagnosis, and bush medicine cure)

"Nuno Lopes" <[email protected]> Mon, 26 Jun 2006 22:57:24 +0100
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <000301c6996b$81f16870$0100a8c0@pc07653>
>> The problem is: how to "fix" the problem without breaking
>> compatibility with older tidy lib versions?
>
> AFAICT GetToken() is private, so existing client apps
> shouldn't be using it anyway.

AH, good point Jeff.
static can't be used, because the function is defined in lexer.c, but used 
in parser.c

But.. gcc offers a good alternative:
__attribute__ ((visibility ("internal")))

gcc docs: 
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bused_007d-attribute_002e-1876

So, I would define a macro, like:
#if defined(__GNUC__) && __GNUC__ >= 3
# define INTERNAL	__attribute__ ((visibility ("internal")))
#else
# define INTERNAL
#endif

And use it like:
Node* INTERNAL GetToken( TidyDocImpl* doc, GetTokenMode mode ) { ... }


Now, its up with tidy developers to choose what they want to do.

And "The" reference for writing shared librarys: 
http://people.redhat.com/drepper/dsohowto.pdf


Nuno 


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642