Jim Helman (jimh++at++surreal)
Thu, 30 Nov 95 13:15:27 -0800
In your example, Iostream_init's storage class is automatic (i.e. on
the stack) rather than static. If you move IoStream_init outside of
the routine so that it has to be constructed globally before test_cpp
is invoked, the example dumps core unless the final link is done with
CC. This is what I meant. Actually, I had thought the same applied
to static instantiation with local scope, i.e.
void test_cpp(void)
{
static Iostream_init tmp;
^^^^^^
cout << "testing" << endl;
}
However this actually does work. SGI's C++ implementation actually
defers construction until the first time the routine is invoked, so
my comment only applies to static global instances.
> Note that the instantiation of the Iostream_init could not have
> been done globally (as CC would do for you).
Perhaps we're saying the same thing.
rgds,
-jim helman
jimh++at++surreal.asd.sgi.com
415/933-1151
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:04 PDT