[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-devtools
Subject:    HPUX-DEVTOOLS: RE: shl_load() isn't running initialization
From:       Robert Seward <seward () hpesrys ! fc ! hp ! com>
Date:       2000-05-31 17:25:00
[Download RAW message or body]

I wrote:
> I am trying to create a shared library, created with g++, that has a static
> constructor.  I then try to load that shared library with shl_load(), but
> the static constructor is not being run.  However, if I link some
> executable using the shared library, the static constructor IS being run.
> So, what is different between automatic loading of the shared library and
> explicit loading with shl_load()?

I still don't know why I get different behavior between linking and using
shl_load(), but I have partialy found a way around my problem.  I discovered
that g++ puts two symbols, _GLOBAL__DI and _GLOBAL__DD, that should be called
for initialization and destruction.  So, if I pass '+I _GLOBAL__DI' to the
loader, I get my initialization.

This is all I need for 99% of the cases, but there are some cases in which
the destruction phase is important.  So, is there a way to tell the loader
about a function to call on destruction?

Robert
 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools
 _________________________________________________________________

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic