lazy load shared objects using gcc

Roberta Reidel P.R.Reidel@t-online.de
Sat Aug 10 01:40:00 GMT 2002


Hello,

i always assumed 'lazy load' to be the default configuration of the
g++/gcc 'frontend'. But i tested this using gcc version 2.96 on 
RedHat 7.1/7.2, and it seems to be 'load now' the default configuration.

Reading the man/info pages of gcc and ld, i guess the ld to support 'lazy
load' ( the -R <file> option ). But the gcc doesn't know any option, except
' -z now ' --- to *turn off* lazy loading. This confirms my assumption of 
'lazy load' beeing the default.

But it doesn't: The error message of missing shared libraries always appears
on start time. To decide between two hardware subsets (eg. pcmcia cards)
i simply want to decide to engage the card of type one or two. 

a simple ' gcc MainApplication.cpp CardTypeOne.so CardTypeTwo.so ' should
call the compiler, Assembler and linker -- preparing lazy load. But it does
a 'load now'. (And this doubles the time to start the Application.)

Please tell me where do i'm going wrong ? Where is my mistake in 
configuration ? Is there really no other way as to go through the ugly 
way of 'dlopen()' + dlsym() ... ??
I always mentioned the ELF format to be the solution to these problems.

Best regards,
  Roberta Reidel



More information about the Gcc mailing list