@@ -649,6 +649,7 @@ def libVersionBlock():
649
649
protected final long nativeObj;
650
650
protected $jname(long addr) { nativeObj = addr; }
651
651
652
+ public long getNativeObjAddr() { return nativeObj; }
652
653
"""
653
654
654
655
T_JAVA_START_MODULE = """
@@ -1004,7 +1005,7 @@ def add_class(self, decl):
1004
1005
classinfo .addImports (classinfo .base )
1005
1006
type_dict ["Ptr_" + name ] = \
1006
1007
{ "j_type" : classinfo .jname ,
1007
- "jn_type" : "long" , "jn_args" : (("__int64" , ".nativeObj " ),),
1008
+ "jn_type" : "long" , "jn_args" : (("__int64" , ".getNativeObjAddr() " ),),
1008
1009
"jni_name" : "*((Ptr<" + classinfo .fullName (isCPP = True )+ ">*)%(n)s_nativeObj)" , "jni_type" : "jlong" ,
1009
1010
"suffix" : "J" }
1010
1011
logging .info ('ok: class %s, name: %s, base: %s' , classinfo , name , classinfo .base )
@@ -1228,7 +1229,7 @@ def gen_func(self, ci, fi, prop_name=''):
1228
1229
if "I" in a .out or not a .out or self .isWrapped (a .ctype ): # input arg, pass by primitive fields
1229
1230
for f in fields :
1230
1231
jn_args .append ( ArgInfo ([ f [0 ], a .name + f [1 ], "" , [], "" ]) )
1231
- jni_args .append ( ArgInfo ([ f [0 ], a .name + f [1 ].replace ("." ,"_" ).replace ("[" ,"" ).replace ("]" ,"" ), "" , [], "" ]) )
1232
+ jni_args .append ( ArgInfo ([ f [0 ], a .name + f [1 ].replace ("." ,"_" ).replace ("[" ,"" ).replace ("]" ,"" ). replace ( "_getNativeObjAddr()" , "_nativeObj" ) , "" , [], "" ]) )
1232
1233
if a .out and not self .isWrapped (a .ctype ): # out arg, pass as double[]
1233
1234
jn_args .append ( ArgInfo ([ "double[]" , "%s_out" % a .name , "" , [], "" ]) )
1234
1235
jni_args .append ( ArgInfo ([ "double[]" , "%s_out" % a .name , "" , [], "" ]) )
@@ -1276,7 +1277,7 @@ def gen_func(self, ci, fi, prop_name=''):
1276
1277
" private static native $type $name($args);\n " ).substitute (\
1277
1278
type = type_dict [fi .ctype ].get ("jn_type" , "double[]" ), \
1278
1279
name = fi .jname + '_' + str (suffix_counter ), \
1279
- args = ", " .join (["%s %s" % (type_dict [a .ctype ]["jn_type" ], a .name .replace ("." ,"_" ).replace ("[" ,"" ).replace ("]" ,"" )) for a in jn_args ])
1280
+ args = ", " .join (["%s %s" % (type_dict [a .ctype ]["jn_type" ], a .name .replace ("." ,"_" ).replace ("[" ,"" ).replace ("]" ,"" ). replace ( "_getNativeObjAddr()" , "_nativeObj" ) ) for a in jn_args ])
1280
1281
) );
1281
1282
1282
1283
# java part:
0 commit comments