Unix Programming - shl_load() limitations in hp-ux?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > shl_load() limitations in hp-ux?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author shl_load() limitations in hp-ux?
one2001boy@yahoo.com

2004-01-23, 5:21 pm

Hello,

I want to check if HP-UX can load the the program itself
with shl_load(). It seems that linux and solaris work fine,
but not for HP-UX.

To dynamically load a library at runtime, Linux and Solaris
use function dlopen(). For example, dlopen("somelib.so", RTLD_LAZY)
can be used.
To load the program itself, use dlopen(NULL, RTLD_LAZY).

In HP-UX, the corresponding function
shl_load() can be used to load a lib at runtime.
For example, shl_load("somelib.so", BIND_VERBOSE, 0);
But, to load the program itself, shl_load(NULL, BIND_BERBOSE, 0)
will not work. Does anyone know how to load the program
itself in HP-UX? or HP-UX doesn't support it at all?

Thanks.


Valentin Nechayev

2004-01-23, 5:21 pm

>>> one2001boy@yahoo.com wrote:

obyc> I want to check if HP-UX can load the the program itself
obyc> with shl_load(). It seems that linux and solaris work fine,
obyc> but not for HP-UX.
obyc>
obyc> To dynamically load a library at runtime, Linux and Solaris
obyc> use function dlopen(). For example, dlopen("somelib.so", RTLD_LAZY)
obyc> can be used.
obyc> To load the program itself, use dlopen(NULL, RTLD_LAZY).

Do you really need analog of dlopen(NULL,) ?
dlsym(NULL,) can get symbols in main binary without extra loading.


-netch-
one2001boy@yahoo.com

2004-01-23, 5:21 pm

Valentin Nechayev wrote:
quote:

>
>
> obyc> I want to check if HP-UX can load the the program itself
> obyc> with shl_load(). It seems that linux and solaris work fine,
> obyc> but not for HP-UX.
> obyc>
> obyc> To dynamically load a library at runtime, Linux and Solaris
> obyc> use function dlopen(). For example, dlopen("somelib.so", RTLD_LAZY)
> obyc> can be used.
> obyc> To load the program itself, use dlopen(NULL, RTLD_LAZY).
>
> Do you really need analog of dlopen(NULL,) ?
> dlsym(NULL,) can get symbols in main binary without extra loading.
>



dlopen(NULL, ) will return non-NULL to load in the main program
in all Unix, except HPUX.
dlsym(non-NULL, ) works in all Unix execpt HPUX.
dlsym(NULL,) works only in HPUX.
not sure why HPUX makes the code for unix porting so painful?

Thanks.


thanks.


quote:

> -netch-



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com