What definition generates the SWIG upcasts in wrappers and what controls it?

"[email protected]" <[email protected]> Sat, 25 Dec 2021 11:28:25 +0000
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
I'm trying to fix OpenCascade SWIG interface.

A bunch of C  wrapper functions like this:

SWIGEXPORT jlong JNICALL Java_org_jcae_opencascade_jni_OccJavaJNI_Handle_1Geom_1Curve_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Handle_Geom_Geometry **)&baseptr = *(Handle_Geom_Curve **)&jarg1;
    return baseptr;
}
cause errors like this:

/Users/nyholku/jCAE/occjava3/src-java/org/jcae/opencascade/jni/OccJavaJAVA_wrap.cxx:7849:42: error: incompatible pointer types assigning to 'Handle_Geom_Geometry *' (aka 'handle<Geom_Geometry> *') from 'Handle_Geom_Curve *' (aka 'handle<Geom_Curve> *')
    *(Handle_Geom_Geometry **)&baseptr = *(Handle_Geom_Curve **)&jarg1;
 
on the otherhand many wrappers like this:

SWIGEXPORT jlong JNICALL Java_org_jcae_opencascade_jni_OccJavaJNI_TopoDS_1Vertex_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(TopoDS_Shape **)&baseptr = *(TopoDS_Vertex **)&jarg1;
    return baseptr;
}

compile without a problem. 

I've tried to see what is the difference in the .i files for  TopoDS / Vertex compared to Geom / Surface but can't figure it out.

What control how those SWIGupcasts are generated?

wbr Kusti