Hi,
I'm trying to port my O/S kernel from C to C++. I am using g++ with the
following command-line switches:
-Wall -fno-builtin -fno-rtti -fno-exceptions -fno-enforce-eh-specs
-nostartfiles -nostdinc -nostdlib
And ld to link it with the -nostdlib switch. There is no C library
available to link with and I assumed I had disabled it with the above
switches. However, if I try and use a local static variable, for example in:
class MyClass {
private:
MyClass() {}
~MyClass() {}
MyClass(const MyClass&);
MyClass& operator=(MyClass);
public:
static MyClass& getInstance() {
static MyClass instance;
return instance;
}
};
I get undefined references to __cxa_atexit and __dso_handle. I assume
these are C library functions? What are they for?
Why are they necessary simply for dealing with static variables; I
thought they [static variables] were just stored in the global data area
like global variables? I obviously have not provided the correct
switches to g++ for it to fully stop trying to use the C library. I'd be
very grateful if someone could inform me of the correct/complete ones
and tell me what's going on here!
Thanks, any help is gratefully received!
Richard Hayden.