Swig type mapping for GUID's

Charles Day cedayiv at gmail.com
Tue Feb 17 18:59:06 EST 2009


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?

Cheers,
Charles


More information about the gnucash-devel mailing list