Re: more detail about pfMalloc & object container

New Message Reply Date view Thread view Subject view Author view

Alejandro Saez (cano++at++silicon.cl)
Tue, 28 Apr 1998 13:20:55 -0400


On Apr 28, 12:33pm, David Chan wrote:
> Subject: more detail about pfMalloc & object container
> HI,
> As the problem describe in my first mail, I want to add more
> detail describtion:
> the abstract class "Console" is derived from "pfObject".
> Since "Console" is abstract class, so it can't be like this:
>
> typedef structure {
> ...
> Console console[10];
> ...
> } SharedData;
>
>
> And also I try to print out the address of shared->console[0], it
> is 0, and it seems I can't assign the address of new object into the
> array. I do it like this:
>
> typedef structure {
> ...
> Console *console[10];
> ...
> } SharedData;
>
> SharedData *shared = (SharedData *)pfMalloc(sizeof(SharedData),
> pfGetSharedArena());
> shared->console[0] = new Dervid_class_from_Console(parm1,parm2);
>
> Then there is segnmentation fault when I try to access object
> inside the array.
> And I can't use "CC" to link object program, because one of my
> program is c program, the others are c++ program with C performer API.
>
> Thanks in advance.
> 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
>
>-- End of excerpt from David Chan
mmh, strange, are you sure you are getting an instance of the class when doing
the new Dervid_class_from_Console(parm1,parm2)? Try, using an aux pointer
holding new's return value, and check is valid. This shouldn't be the problem
but just to eliminate the posibility.

-- 
------------------------------------------------------------------------
Alejandro Saez
Software Engineer
Silicon Chile S.A.
                                        Avda. Andres Bello 2777, Of. 602
E-mail: asaez++at++silicon.cl              	Providencia
Phone:  +56 (2) 203 3371 Ext. 105       Santiago
Fax:    +56 (2) 203 3370                Chile
------------------------------------------------------------------------
=======================================================================
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:57:18 PDT

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