Browse Source

* pas2jni: Typecast interface to pointer.

git-svn-id: trunk@32616 -
yury 9 years ago
parent
commit
f6b99c5d6a
1 changed files with 8 additions and 4 deletions
  1. 8 4
      utils/pas2jni/writer.pas

+ 8 - 4
utils/pas2jni/writer.pas

@@ -1853,10 +1853,14 @@ begin
             Result:=Format('_StringToJString(_env, _JNIString(GUIDToString(%s)))', [Result]);
         end;
     dtClass:
-      if TClassDef(d).CType in [ctObject, ctRecord] then
-        Result:=Format('_%s_CreateObj(_env, %s)', [GetClassPrefix(d), Result])
-      else
-        Result:=Format('_CreateJavaObj(_env, %s, %s)', [Result, GetTypeInfoVar(d)]);
+      case TClassDef(d).CType of
+        ctObject, ctRecord:
+          Result:=Format('_%s_CreateObj(_env, %s)', [GetClassPrefix(d), Result]);
+        ctInterface:
+          Result:=Format('_CreateJavaObj(_env, pointer(%s), %s)', [Result, GetTypeInfoVar(d)]);
+        else
+          Result:=Format('_CreateJavaObj(_env, %s, %s)', [Result, GetTypeInfoVar(d)]);
+      end;
     dtProcType:
       Result:=Format('_CreateMethodPtrObject(_env, TMethod(%s), %s)', [Result, GetTypeInfoVar(d)]);
     dtEnum: