From: Stefan Z. <ste...@am...> - 2009-05-19 17:10:34
|
(Re-posting this after subscribing to the list). I'm having some trouble getting the casting information correct for a set of related modules, and it looks to me like something's wrong in SWIG_InitializeModule. Here's the scenario that's failing for me: - Module Foo is loaded first. - Foo knows about types Parent and Child, but it doesn't know that a Child can be cast to Parent. - Module Bar is loaded second. - Module Bar knows about Parent and Child, and it DOES know that Child can be cast to Parent. In this case, when module Bar is being loaded, the swig_type_info for Child is correctly imported from Foo into Bar. However, the swig_cast_info for casting Child to Parent still points to Child's swig_type_info from swig_module.type_initial in Bar, rather than the swig_type_info imported from Foo. The following patch works for me; am I missing anything? Thanks, Stefan Zager =================================================================== --- swiginit.swg (revision 11216) +++ swiginit.swg (working copy) @@ -150,11 +150,11 @@ #endif } if (ret) { + cast->type = ret; if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif - cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ |