This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hello, ...so I tried to create my own smobs using a C++ function like this : SCM createInstance() { Object* obj = new Object; SCM smob; SCM_NEWCELL(smob); SCM_SETCAR(smob, ObjectTag); SCM_SETCDR(smob, obj); return smob; } This function was registered via gh_new_procedure() and therefor callable by guile code. The class 'Object' is keeping references to other scheme objects and a mark function for garbage collection was needed to let these objects survive garbage collection, too : SCM mark(SCM s) { ... SCM_ASSERT( (SCM_NIMP(s) && SCM_CAR(s) == ObjectTag), s, SCM_ARG1, "mark" ); ... return SCM_BOOL_F; } The assertion always falied, because the tags did not match. When created by createInstance(), the new object got #x1EF7 as tag value, the mark function was called with a parameter tagged with #x1EFF. The CDR of the smob was equal in both cases. I did not completely understand the code in "libguile/tags.h". Is only a part of the tag used for object type information ? If so, is there a function returning just these valid bits for comparison with the tag value returned by scm_newsmob() during object registration ? Thank you in advance, Frank --- Mail: frankc@senax.iguana.priconet.de WWW : http://www.tu-bs.de/~y0000070