Re: pfMalloc & object container

New Message Reply Date view Thread view Subject view Author view

Alejandro Saez (cano++at++silicon.cl)
Tue, 28 Apr 1998 11:32:38 -0400


On Apr 28, 10:25am, David Chan wrote:
> Subject: pfMalloc & object container
> HI,
> I have a problem with pfMalloc when I am using pfMalloc to create
> a shared memory. Here is my simple code:
>
> shared=(SharedData *)pfMalloc(sizeof(SharedData),
> pfGetSharedArena());
>
> while SharedData is a typedef structure, and inside SharedData, there is a
> Class container:
>
> typedef structure {
> ....
> Console *console[10];
> ....
> } SharedData;
>
> Where Class "Console" is an abstract class, the array is to store derived
> class from "Console".
> I can create an object and assign it into the array, but after
> that, when I want to access the object's public function like this:
>
> shared->console[0]->
>
> It is always segmentation falut.
> I am using "CC" to compile and "cc" to link the object programs on IRIX
> 6.2 Indy.
>
> Any comment are welcome.
> 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

Could you be more specific about the error you get, and the stack trace. If the
stack trace doesn't get beyond the function that executes shared->console[0]->
then it I would presume (which I shouldn't be doing without the appropiate
info) that there isn't actually an instance of the class in the array. Did you
try printing the value of console[0], it should be a valid address.
        If it gets past that function and execution actually enters the class's
method you called, that is a different story.

-- 
------------------------------------------------------------------------
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.