public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: -l versus dlopen()
@ 2001-09-09 20:23 Daniel.Walker
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel.Walker @ 2001-09-09 20:23 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-help

In desperate trial and error, I've tried giving dlopen() all combinations
of flags:

RTLD_LAZY
RTLD_LAZY | RTLD_GLOBAL
RTLD_NOW
RTLD_NOW | RTLD_GLOBAL

None of them seen to have any affect on the problem. I really suspect that
the order of global constructors is changing in a way that breaks
dependencies somehow. I've heard this can be a problem in C++. Any
suggestion for controlling this?

Thanks!
Daniel Walker



                                                                                                           
                    Alexandre                                                                              
                    Oliva                To:     Daniel.Walker@lhsl.com                                    
                    <aoliva@redhat       cc:     gcc-help@gcc.gnu.org                                      
                    .com>                Subject:     Re: -l versus dlopen()                               
                                                                                                           
                    09/09/2001                                                                             
                    07:34 PM                                                                               
                                                                                                           
                                                                                                           




On Sep  7, 2001, Daniel.Walker@lhsl.com wrote:

> But if I link dynamically with dlopen()

Which flags do you pass to dlopen()?

> the program crashes while executing a global constructor in
> _do_global_ctors_aux(). Is it possible that the constructors in the
library
> are reorder differently depending on how the library is loaded?

Yes, that's certainly possible.

--
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: -l versus dlopen()
  2001-09-07 10:41 Daniel.Walker
@ 2001-09-09 19:04 ` Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2001-09-09 19:04 UTC (permalink / raw)
  To: Daniel.Walker; +Cc: gcc-help

On Sep  7, 2001, Daniel.Walker@lhsl.com wrote:

> But if I link dynamically with dlopen()

Which flags do you pass to dlopen()?

> the program crashes while executing a global constructor in
> _do_global_ctors_aux(). Is it possible that the constructors in the library
> are reorder differently depending on how the library is loaded?

Yes, that's certainly possible.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 3+ messages in thread

* -l versus dlopen()
@ 2001-09-07 10:41 Daniel.Walker
  2001-09-09 19:04 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel.Walker @ 2001-09-07 10:41 UTC (permalink / raw)
  To: gcc-help

Hello,
I'm not sure if this is the right place to ask this question since it
probably has more to do with ld.so. If I'm in the wrong place maybe someone
can point me in the right direction.

I'm running Linux 2.4, gcc 3.0.

I have a C++ shared object, libfoo.so, compiled with -fPIC & -shared. If I
compile an executable with -lfoo, the library is loaded and everything is
fine. But if I link dynamically with dlopen() (compiled with -rdynamic),
the program crashes while executing a global constructor in
_do_global_ctors_aux(). Is it possible that the constructors in the library
are reorder differently depending on how the library is loaded? I've tried
it with several combinations of dlopen's flags and nothing seems to help.
I'm at a complete loss.

Thanks
Daniel Walker

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-09 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-09 20:23 -l versus dlopen() Daniel.Walker
  -- strict thread matches above, loose matches on Subject: below --
2001-09-07 10:41 Daniel.Walker
2001-09-09 19:04 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).