Hello,

I found my constructor problem and thought I'd share it with you all. 

I am compiling two directories into intermediate objects. Both directories contain 
mixed C and C++ files. Then at the last stage of compilation I link the two 
intermediate object files togehter. 

It is in the last stage of linking that you must do the $(CRTBEGIN) and $(CRTEND) 
stuff. I leave the first linking stages as "normal" (i.e. without these CRT macros) 
and just leave it up to the last step. 

As an aide, before trying anything else to fix a C++ program that crashes, make sure 
constructors are working. You can do the following as a quick test:

// globals
int foo=1;

typedef struct
{
    int & foobar
}test_ctors_t

test_ctors_t test_struct = { foo }

some_init_code()
{
    assert(&test_struct.foobar == NULL)
}


I think I'm going to refine this and put it in my code as a runtime check...It just 
seems to rear its ugly head and the symptoms aren't always easy to spot, your program 
simply crashed on null pointers. Hope this helps someone.

Thanks,

~Ken

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to