This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Wrapping versioned glibc symbol


On Monday 27 April 2009 05:25:53 Tomash Brechko wrote:
> 1 For some functions glibc provides underscored versions (like
>   __pthread_mutex_lock() as an alias for pthread_mutex_lock()
>   (actually vice versa I guess).  When I want to provide by own
>   version of this function, while calling the original one, should I
>   call __pthread_mutex_lock() directly, or use dlsym(XXX,
>   "pthread_mutex_lock").  Dynamic linking is assumed.  What is the
>   Best Current Practice?  Actually now I think I should use dlsym(),
>   as it allows for cascading wrappers (though I've seen quite a few
>   examples of calling underscored version before).

you should never call the underscored version.  they indicate internal glibc 
functions which may not even have the same definition as the non-underscored 
version.

> 2 For some functions (mostly versioned ones) glibc doesn't provide
>   underscored variant.  Is there a way to call versioned function not
>   using dlsym()?  (This is what I ambiguously called "the static way".)

i'm pretty sure there is no way to control behavior with symboled versions and 
dlsym().
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]