O
Oystein Haare
Note: This might be a bit off topic..
I want to create some global objects that register themselves with another
"manager"-class upon creation:
class SomeClass { ... };
// cpp:
SomeClass globalObj;
// other code
This works fine when I just compile and link everything at the same time.
However, if I compile the stuff with global objects and manager as a
static library (*.a) on linux, and try linking it with some client code,
it doesn't seem to work.
I guess it might be
because the symbols in the lib aren't actually resolved or handled at all
when I don't reference them in my client code, but how can I make it work?
Is there another way than to put this object creation into a function?
This is all compiled with g++, lib created with 'ar'.
Hope I managed to describe my problem good enough...
I want to create some global objects that register themselves with another
"manager"-class upon creation:
class SomeClass { ... };
// cpp:
SomeClass globalObj;
// other code
This works fine when I just compile and link everything at the same time.
However, if I compile the stuff with global objects and manager as a
static library (*.a) on linux, and try linking it with some client code,
it doesn't seem to work.
I guess it might be
because the symbols in the lib aren't actually resolved or handled at all
when I don't reference them in my client code, but how can I make it work?
Is there another way than to put this object creation into a function?
This is all compiled with g++, lib created with 'ar'.
Hope I managed to describe my problem good enough...