Re: iostreams and Performer

New Message Reply Date view Thread view Subject view Author view

Prakash Mahesh (prakash++at++drawcomp.com)
Mon, 01 Dec 1997 17:49:55 -0500


Gordon Tomlinson wrote:
>
> Hi Guys
>
> We are experiencing problems with using iostreams and performer.
>
> ie simple cout cause a segmentation fault
>
> My colleague remmebers some postings on the issue some time agom some thing about
> the default constructor not being called but we cannot find references in the archives.
>
> Has any kind sole got any info on this or a pointer to the location of any info.

I am not sure what exactly you were trying to do, but this is what I was
doing, when I got into similar problems.

My application starts with Java (where the main function is), and using
Java Native Interface, I got into C, and then C++, and eventually called
Performer functions. And in this case, everytime, it encountered an
iostream call, it was crashing.

After lot of research, we found that it was a simple C++ issue. Just
before main() function is called, the global constructors are called,
thereby initializing the iostream stuff. In my case, there was no main()
in the C/C++ side (it was in the Java side). So, the initizlizations
were never done.

So, this is going to happen, whenever you don't have a C/C++ main() in
your application. This has nothing to do with Performer (as far as I
know).

There is a workaround (assuming that this is what your problem is). From
tha documentation for CC/ld you can see that you can do the
initializations yourself as below:

#include <iostream.h>

extern Iostream_init *io;

io = Iostream_init();

The first two lines comes all the way in the beginning of your first C++
file, and the third line (please check the exact syntax) probably before
any cerr/cout/cin.

Hope this helps.

-- 
  Prakash Mahesh                                     
  prakash++at++drawcomp.com
  	--or--
  prakash++at++openworlds.com
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:19 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.