problem with static member variable in dynamic library

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

 



hi,

i'm having a problems with the use of static member variables inside
a dynamic library.

an example of the problem:

class OtherClass
{
	// ...
};

class ThisClass
{
	private:
		static OtherClass ok;
		static int alsoOk;
		static std::string error;
};

(the static members are instantiated in the .cpp file)

the code compiles and links, the problem arises when loading the
dynamic library: it's ok to have library interal classes (like
OtherClass) or basic types (like the int) as static members but when
using 'external' classes like std::string or others, the loading of
the library fails. the utility dltest reports the error "undefined
symbol: __dso_handle".

the system is an amd athlon 1 GHz, running Fedora Core 2, with g++
version 3.3.3. the compiler options are "-W -Wall -pthread -march=i586
-ggdb". linking is done with "ld -nostartfiles -shared -o libfoo.so
<objects> -lpthread <project libs>"

thanks in advance

matze

-- 
    I am incapable of conceiving infinity, and yet I do not accept finity
                          (Simone de Beauvoir)

    ( ( ( i ) ) )  http://barcelona.indymedia.org  ( ( ( i ) ) )
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver keys.indymedia.org --recv-keys B9A88F6F           `-

Attachment: signature.asc
Description: Digital signature


[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