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

scheme_make_class_assembly



I'm trying to make a class using scheme_make_class_assembly.
Unfortunately, I'm experiencing a crash inside GetIvar.

It appears that GetIvar wants to do this:

int level = mclass->cmethod_ready_level[mclass->vslot_map[vp]];

but unfortunately, mclass->cmethod_ready_level = NULL
:-(


I've wandered through the code a bit and concluded that the best chance for
cmethod_ready_level to ever amount to anything occurs inside

scheme_DefineClass_execute

unfortunately, this opportunity is missed. :-(
In fact, I observed in several places, cmethod_ready_level appears to be
quite deliberately set to NULL. So I suspect that perhaps I'm doing
something wrong.

Anyway, here's the class assembly that I'm passing to scheme_create_class:


Scheme_Class_Assembly *gl_array_class_assembly  = scheme_make_class_assembly
("gl-array%", 
0,
iPublicNames, psoPublicNames,
0, NULL,
0, NULL,
0, NULL,
0, 1,
initialize_gl_array_class);


In summary, a nice name:

"gl-array%"
Zero interfaces.
iPublicNames = 1,

psoPublicNames[0] = scheme_intern_symbol("dump");

There are no overrides, inherits, renames.

Arity is valid.

initialize_gl_array_class is a nice function that never gets called thanks
to the crash.


Here's what my call to scheme_create_class looks like:

return scheme_create_class(gl_array_class_assembly, (void *)data, NULL,
NULL);


The only thing that comes to mind, is that I should provide at least one for
the number of interfaces
(2nd param)
to scheme_make_class_assembly

Is this correct?
Should I first make an interface for this thing using
scheme_make_interface_assembly and then scheme_create_interface?


Oddly enough, the code sometimes runs *without* crashing! Three scenarious:
1. Crashes as described above.
2. Doesn't crash, but the dump method is not there when I instantiate the
class. i.e. error message
says I'm crazy when I try (send o dump)
3. Doesn't crash, dump method works. (but program is still prone to crashing
on a subsequent call to scheme_create_class)

This observation, throws my assumption that I am merely doing something
wrong, into a cocked hat. So perhaps
there is more...

Any ideas?

Thanks.