OVH Cloud OVH Cloud

dynamic library and initialisation

6 réponses
Avatar
beus
Hi,

i was using a static librairy libFoo.a containing a class with a
static member initialized via a static method like in this little
exemple :

Foo.hh :

class Foo
{
public :
static int f();
static int a;
};

Foo.cc :

int Foo::a = Foo:f();

and everythings was ok.

But now i need to make the library dynamic, and the problem is that
Foo::a is initialized with 0, and not with the value return by the
method Foo::f().

Is there a way to make Foo::a initialized via Foo::f() in a dynamic
library ?

6 réponses

Avatar
Fabien LE LEZ
On 31 Aug 2004 03:04:44 -0700, (beus):

i was using a static


Tu t'es trompé de forum. Pour un forum sur le C++ en anglais, cf
comp.lang.c++ et comp.lang.c++.moderated.
Wrong newsgroup. The English-speaking newsgroups about C++ are
comp.lang.c++ and comp.lang.c++.moderated.

librairy


Snif, pour une fois que quelqu'un écrit en anglais et donc a raison
d'écrire "library", il l'orthographe mal... ~_~



--
;-)

Avatar
Fabien LE LEZ
On 31 Aug 2004 03:04:44 -0700, (beus):

i was using a static


Tu t'es trompé de forum. Pour un forum sur le C++ en anglais, cf
comp.lang.c++ et comp.lang.c++.moderated.
Wrong newsgroup. The English-speaking newsgroups about C++ are
comp.lang.c++ and comp.lang.c++.moderated.

librairy


Snif, pour une fois que quelqu'un écrit en anglais et donc a raison
d'écrire "library", il l'orthographie mal... ~_~



--
;-)

Avatar
Fabien LE LEZ
On Tue, 31 Aug 2004 14:27:15 +0200, "K. Ahausse"
:

Organization: Wanadoo, l'internet avec France Telecom


Tiens, Wanadoo vient d'être racheté par AOL ?


--
;-)

Avatar
K. Ahausse
"beus" a écrit dans le message de
news:
Hi,

i was using a static librairy libFoo.a containing a class with a
static member initialized via a static method like in this little
exemple :

Foo.hh :

class Foo
{
public :
static int f();
static int a;
};

Foo.cc :

int Foo::a = Foo:f();

and everythings was ok.

But now i need to make the library dynamic, and the problem is that
Foo::a is initialized with 0, and not with the value return by the
method Foo::f().

Is there a way to make Foo::a initialized via Foo::f() in a dynamic
library ?


Yes

Avatar
beus
"K. Ahausse" wrote in message news:<ch1qfe$383$...
"beus" a écrit dans le message de
news:
Hi,

i was using a static librairy libFoo.a containing a class with a
static member initialized via a static method like in this little
exemple :

Foo.hh :

class Foo
{
public :
static int f();
static int a;
};

Foo.cc :

int Foo::a = Foo:f();

and everythings was ok.

But now i need to make the library dynamic, and the problem is that
Foo::a is initialized with 0, and not with the value return by the
method Foo::f().

Is there a way to make Foo::a initialized via Foo::f() in a dynamic
library ?


Yes


interessing... and what is this way ?


Avatar
Matthieu Moy
(beus) writes:

interessing... and what is this way ?


Asking the question in french so that tout le monde understand ? ;-)

--
Matthieu