I had understood your point :) When saying "...that will prevent a program from linking with the Linux Threads library..." what exact errors are you getting? I though it's possible to link your programm against both those libraries at the same time. There are some functions that exist in NPTL and not in Linux Threads. If you compile using only the Linux Threads libary (eg. /usr/lib/libpthread.so), and you code uses the function,
I realy don't understand How you could check this at run time since the
program will NOT even LOAD to start running if you are linked agaist the
NPTL and it isn't available via the LD_LIBRARY_PATH specified when you
start the program.
Your program will just fail to start with an error message about not
being abe to find a symbol.
Now if you specify LAZY_BINDING your program will start up, but will
crash when you try to access this service. Personally I find
LAZY_BINDING a pain because I don't find out until 3 hours into my
program that somehting didn't load right.
I guess the real question you need to ask yourself is...
what is your program going to do if that symbol isn't available?
Does your program function properly without that service?
If you program can live without it why did you need it in the first
place?
Typically for Dynamic checking of library services you can not use them
by name in your code because of the above problems.
The best you can do is to reference them via FUNCTION POINTERS that You
yourself calculate at runtime.
You open the library you want try to resolve symbols in
figure out the address of that function
assign it to a function pointer.
If that function doesn't exist set your pointer to null.
Then in your code you specify
if ( pthread_tryjoin_np_ptr != NULL )
/* function exists */
(*pthread_tryjoin_np_ptr) (params)
else
???????
But again like I said....What does your progam do on the ELSE side?
-----Original Message-----
From: Jerry Feldman [mailto:gaf@blu.org]
Sent: Friday, March 04, 2005 8:37 AM
To: suse-programming-e@suse.com
Subject: Re: [suse-programming-e] linux Threads vs. NPTL
On Friday 04 March 2005 10:51 am, Dimych wrote:
pthread_tryjoin_np(), it will fail to link.
What I am really looking for is a way to detect at run time, if the code
has been linked with the nptl library or not.
--
Jerry Feldman