Swig type mapping for GUID's

Derek Atkins warlord at MIT.EDU
Wed Feb 18 10:03:28 EST 2009

Charles Day <cedayiv at gmail.com> writes:

> I have a question about the current type mapping that swig does for GUID
> pointers. Currently, if a C function returns a GUID* that is a null pointer
> (== NULL), swig converts it to SCM_UNDEFINED and hands that to guile. From
> src/base-typemaps.i:
> %typemap(out) GUID * " $result = ($1) ? gnc_guid2scm(*($1)): SCM_UNDEFINED;
> "
> Unfortunately, returning SCM_UNDEFINED to guile causes the variable on the
> guile side to become unbound, leading to crashes (bug #530819, for example).
> There is apparently no way to test for this condition from guile, so it
> seems to me that swig should never return SCM_UNDEFINED to guile.
> Does anyone know why the type mapping has been defined this way? Shouldn't
> it be redefined to return SCM_BOOL_F instead?

Either that or gnc_guid2scm(guidnull()) ??
I'm not sure why it is the way it is, nor am I sure what it SHOULD be.
SCM_BOOL_F probably is correct.

> Cheers,
> Charles


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list