Re: How do I found out which .i rule/pattern generates a specific (illegal) C++ code fragment?

Kustaa Nyholm <[email protected]>
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
> 

Further details, maybe my *question* was actually wrong!

There seems to be actually 12 occurrences of the same code/pattern in the generated file but only the
one I referred to in the original question causes compile error.




For example this is ok:

// From SWIG generated wrapper
SWIGEXPORT jlong JNICALL Java_org_jcae_opencascade_jni_OccJavaJNI_BRepBuilderAPI_1MakeShape_1shape(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   ...
  TopoDS_Shape *result = 0 ;
   ...
  result = (TopoDS_Shape *) &((BRepBuilderAPI_MakeShape const *)arg1)->Shape();


// This is the OpenCascade C++ declaration (AFAIU):
class BRepBuilderAPI_MakeShape {
	....
	virtual const TopoDS_Shape & 	Shape ()





But this results in 'taking the address of a temporary object of type' error:

// From SWIG generated wrapper

SWIGEXPORT jlong JNICALL Java_org_jcae_opencascade_jni_OccJavaJNI_BRepBuilderAPI_1ModifyShape_1modifiedShape(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  ...
  TopoDS_Shape *result = 0 ;
  ...
  result = (TopoDS_Shape *) &((BRepBuilderAPI_ModifyShape const *)arg1)->ModifiedShape((TopoDS_Shape const &)*arg2);

// This is the OpenCascade C++ declaration (AFAIU):
class BRepBuilderAPI_ModifyShape {
	...
	virtual TopoDS_Shape 	ModifiedShape (const TopoDS_Shape &S) const 



The difference that I see on the C++/OCC side is the 'const' in the return type.


If that is the problem how can I fix this in the '.i' files without touching OCC sources.
(I suspect the missing 'const' is really a bug or omission but it is what it is).


wbr Kusti


> 
> 
> 
> _______________________________________________
> Swig-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swig-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.