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

"Nuno Lopes" <[email protected]> Tue, 27 Jun 2006 15:12:11 +0100
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <000901c699f3$b0e09a10$0100a8c0@pc07653>
Just on gcc >= 4.0: -fvisibility=internal or -fvisibility=hidden.

The problem is that not everyone is using gcc 4 (like me)..
Maybe you can just mark the problematic function for now and in the future 
use the new gcc 4 features.

Nuno

----- Original Message ----- 
> Thanks for the info.  LibTidy already has the TIDY_EXPORT macro.  Is there 
> a way on GCC to reverse the semantics?  I.e. hide everything except that 
> which is expressly exported?
>
> At 10:57 PM 6/26/2006 +0100, Nuno Lopes wrote:
>> >> 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