What are the features that I can use in c++ freestanding environment? I am developing a little kernel (for my own pleasure) and I know that I can't use the whole stdlib library, but what else ? when I tried to use the new and delete operators it compiled without troubles but the linker said
undefined reference to `operator new[](unsigned long)
undefined reference to `operator delete[](void*)'
I link with -lgcc and -lsupc++ options. I know that exception handling is disable in freestanding but I am a little bit surprised that new and delete are also. So what can I use and what can I not?
Much of freestanding implementations is implementation defined:
Note that
malloc/freeare not listed in the required functions of<cstdlib>.As far as your linker error is concerned, neither freestanding, nor hosted implementation is required to provide those overloads:
In practice, since a free standing environment cannot depend on an OS, and
mallocis usually implemented using features provided by an OS, it is unlikely to have free store memory management features in a freestanding environment. Conversely, a hosted environment requires free store memory management to implement the features of the standard library.