help-gplusplus
[Top][All Lists]
Advanced

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

Re: static members in shared libraries


From: Spaceman
Subject: Re: static members in shared libraries
Date: 13 Jul 2006 15:05:31 -0700
User-agent: G2/0.2

Thanks very much for your help, it works a treat.
p.s. You guessed me correctly as a Win32 bod !!!

Paul Pluzhnikov wrote:
> "Spaceman" <staceyj71@yahoo.co.uk> writes:
>
> > If I compile this to generate the shared library and executable using
> > the -fPIC option I get the following output:
> >
> > My Value= 10;
> > My Value= 99;
> > My Value= 99;
>
> That's correct output ...
>
> > However, The output I would expect is:
> > My Value= 10;
> > My Value= 99;
> > My Value= 10;
>
> Your expectations are incorrect (probably influenced by your
> experience with Win32 DLL model, which is very different from all
> other UNIXes (except AIX)).
>
> > Can anyone please help with this?
>
> You need to specify platform (I'll assume Linux/x86_64).
>
> You can get behaviour similar to Win32 by linking the shared library
> with -Bsymbolic linker flag (prefix it with -Wl, when using 'gcc'
> or 'g++'), or by localizing CommonElement::m_static with a linker
> version script (info ld -> Scripts -> VERSION).
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]