r14663 - gnucash/branches/swigify/src/business - The arguments that point to structs defined in the same module as the

Chris Shoemaker c.shoemaker at cox.net
Mon Aug 14 20:10:52 EDT 2006


On Mon, Aug 14, 2006 at 01:23:20PM -0400, Derek Atkins wrote:
> Chris Shoemaker <chris at cvs.gnucash.org> writes:
> 
> >    The arguments that point to structs defined in the same module as the 
> >    function being wrapped are typed as taking a pointer to the "real" struct, 
> >    not the "public" typedef'd name of the struct.  If functions in other
> >    modules use the same pointer arguments, and SWIG isn't told about the
> >    typedef to the struct, then these wrappers will be typed with an
> >    incompatible generic pointer type with the public type name.
> >
> >    This commit resolves this by 1) using SWIG's %import directive to see the
> >    typedef to the struct name, 2) associated -Imodule lines in Makefile.am, 
> >    3) using the mangled form of the real struct name anywhere we need a 
> >    runtime type query.  Got it?
> 
> So basically what you're saying is that with SWIG you can't use
> the public typedef name?  That seems...  Wrong.

I'm not 100% sure about this stuff, but I _think_ the wrappers have to
use the same type name "inside" the module as "outside".  By default,
swig seems to resolve the typedef to the real structure type inside
the module, therefore I guess we have to use that name outside as
well.  There might be some way to cause swig to use the public typedef
name even inside the module, but I don't know how.

Oh, wait a sec, I think maybe you can use a less-exact string for the
type-query and it does a more exhaustive search, but using the precise
name of the resolved struct type works faster.

Feel free to test out better approaches.

-chris


More information about the gnucash-devel mailing list