David Chan (dchan++at++zeus.lnk.com)
Wed, 29 Apr 1998 12:02:08 -0400 (EDT)
class Console: public pfObject {
protected: int dummy;
public:
int getDummy() { dummy = 2; return dummy; }
int getOne() { return 1; }
virtual void interaction()=0;
}
class Dervied_from_Console : public Console
{
...
public: virtual void interaction() { ... }
...
}
typedef structure {
...
Console *console[10];
...
} SharedData;
SharedData *shared = pfMalloc(sizeof(SharedData),pfGetSharedArena());
shared->console[0] = new Dervied_from_Console();
printf("first try: %d\n",shared->console[0]->getOne()); // this statement is ok
printf("second try: %d\n",shared->console[0]->getDummy()); //Segnmentation fault
======================================================
I do the allocation of shared memory before pfConfig(), and I have try to
use malloc() to allocate memory in non-performer appilication. In that
case, both "printf" work fine.
Any comments are welcome.
David Chan
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:19 PDT