[uClibc]The constructor of global variable cann't be executed in C++

kjlin kj.lin at viditec-netmedia.com.tw
Thu Nov 15 07:55:36 UTC 2001


Hi all,

I am using uclinux-2.4.1+MIPS and compiler is gcc-2.96 20000731.
All the APs which written by C code are executed very well in my uclinux+MIPS.
Howerer, the APs made by C++ are not so fine.
The C++ problem is that the constructor of a global object will not be executed,
but the constructor of a local object is executed normally.
For example:

#include <stdio.h>
class A{
public:
            A(int id) { printf("The constructor ID=%d!\n", id); };
};

A out(0);                        // global 

int main()
{
    A in(1);                      // local
    return 0;
}

The output is:
# The constructor ID=1

Only the constructor of the local variable "in" was executed.
Dose the problem concern with my uClibc?

Thanks for your hints.
KJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20011115/40199207/attachment-0001.htm 


More information about the uClibc mailing list