Open GoogleCodeExporter opened 9 years ago
Alas, 1/2 a year later and this error still shows up compiling on 10.8.
Basically, osgswig wont compile on osx with clang as compiler.
What to do...
Original comment by jellefer...@gmail.com
on 28 Dec 2012 at 1:27
I can work around this compile error on Mac by inelegantly inserting the line
"%ignore getParents;"
in the file "src/osg.i". But I am still in the process of getting the full
osgswig to build on my Mac with Mac OS 10.9.5.
Original comment by Christop...@gmail.com
on 4 Sep 2014 at 4:48
It turns out that my application actually uses the "getParents" method, so my
previous comment workaround does not suffice for me. I ended up manually
modifying the C++ code generated by SWIG. In all 14 places with an error. That
was tedious. I hope some swig guru here can figure out how to do this
automatically.
I ended up changing methods that look like this:...
*********************
SWIGINTERN PyObject *_wrap_LODRef_getParents(PyObject *SWIGUNUSEDPARM(self),
PyObject *args) {
PyObject *resultobj = 0;
osg::ref_ptr< osg::LOD > *arg1 = (osg::ref_ptr< osg::LOD > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
osg::Node::ParentList *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:LODRef_getParents",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_osg__ref_ptrT_osg__LOD_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LODRef_getParents" "', argument " "1"" of type '" "osg::ref_ptr< osg::LOD > const *""'");
}
arg1 = reinterpret_cast< osg::ref_ptr< osg::LOD > * >(argp1);
result = (osg::Node::ParentList *) &(*arg1)->getParents();
resultobj = swig::from(static_cast< std::vector<osg::Group*,std::allocator< osg::Group * > > >(*result));
return resultobj;
fail:
return NULL;
}
****************
...into something that can compile without error in clang, like this:
****************
SWIGINTERN PyObject *_wrap_LODRef_getParents(PyObject *SWIGUNUSEDPARM(self),
PyObject *args) {
PyObject *resultobj = 0;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:LODRef_getParents",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_osg__ref_ptrT_osg__LOD_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LODRef_getParents" "', argument " "1"" of type '" "osg::ref_ptr< osg::LOD > const *""'");
}
{ // 1 - moved result calculation and return, into its own local scope, between fail call, and fail label
// 2 - moved declaration of "result" and "arg1" vars into local scope
osg::ref_ptr< osg::LOD > *arg1 = (osg::ref_ptr< osg::LOD > *) 0 ;
osg::Node::ParentList *result = 0 ;
arg1 = reinterpret_cast< osg::ref_ptr< osg::LOD > * >(argp1);
// 3 - create local variable "parents", to avoid taking address of temporary
const osg::Node::ParentList& parents = (*arg1)->getParents();
// 4 - take address of local variable, instead of temporary
result = (osg::Node::ParentList *) &parents;
resultobj = swig::from(static_cast< std::vector<osg::Group*,std::allocator< osg::Group * > > >(*result));
return resultobj;
}
fail:
return NULL;
}
*****************
It sure would be nice to find a non-manual way of doing this.
Original comment by Christop...@gmail.com
on 5 Sep 2014 at 4:23
Original issue reported on code.google.com by
deuscovr...@gmail.com
on 31 Aug 2012 at 11:32