Static objects and shared libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

We need to confirm our conclusions from the attached example. 

The example does:
  1 - dlopen a shared library
  2 - calls f() inside the shared library. f() has a static non-pod object inside it
  3 - dlcloses the library
  4 - dlopen the same library again
  5 - calls again the function f() inside the library
  6 - dlcloses the library
  7 - returns from main

The static object inside f() is constructed between 2 and 3 and is destroyed after 7.

We think (in a very modest way) this behaivour is c++ compliant: the destruction of object with static storage occurs after main return (or call to exit).

Our question is: is this behaviour guaranteed to work? Doesn't dlclose unmap the shared library in between?

thanks


Platform data:

uname -a 
Linux aquila.ats-ar.com.ar 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686 i386 GNU/Linux

gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)


 


      Los referentes más importantes en compra/ venta de autos se juntaron:
Demotores y Yahoo!
Ahora comprar o vender tu auto es más fácil. Vistá ar.autos.yahoo.com/

Attachment: example.tar.gz
Description: Unix tar archive


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux