[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] writing primitives



On Wednesday, November 27, 2002, at 08:53  AM, crucial felix wrote:


On Wednesday, November 27, 2002, at 12:19 AM, James McCartney wrote:


you need to #include "GC.h"

right.

now i crash:

            int i;
            int count = [urls count];
            // array to return
PyrObject *scArray = (PyrObject*)instantiateObject(g->gc, class_array, count, false, true);
            SetObject(receiver,scArray);
            //g->gc->GCWrite(scArray,receiver);

            for (i = 0; i < count; i++)
            {
                NSString *nspath = [[urls objectAtIndex: i ] path];
                NSLog (@"Object at index %d is: %@", i, nspath);

PyrString* pyrPathString = newPyrString(g->gc,[nspath cString],0,true);

                PyrSlot *slot;
                SetObject(slot,pyrPathString);
                putIndexedSlot(g ,scArray,slot  ,count);

SetObject takes a pointer to a slot, but variable 'slot' is uninitialized.
You should do this:

				PyrSlot slot;
				SetObject(&slot, pyrPathString);
                putIndexedSlot(g ,scArray, &slot  ,count);

--
--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time synthesis programming language for the PowerMac.
<ftp://www.audiosynth.com/pub/updates/SC2.2.16.sea.hqx>