File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Samples/SwiftKitSampleApp/src/main/java/com/example/swift Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,11 @@ static void examples() {
4646
4747 MySwiftClass obj = new MySwiftClass (2222 , 7777 );
4848
49- SwiftKit .retain (obj .$memorySegment ());
50- System .out .println ("[java] obj ref count = " + SwiftKit .retainCount (obj .$memorySegment ()));
49+ // SwiftKit.retain(obj.$memorySegment());
50+ // System.out.println("[java] obj ref count = " + SwiftKit.retainCount(obj.$memorySegment()));
5151
5252 obj .voidMethod ();
53- obj .takeIntMethod (42 );
53+ // obj.takeIntMethod(42);
5454
5555 System .out .println ("DONE." );
5656 }
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ struct SwiftThunkTranslator {
7171 return
7272 """
7373 @_cdecl( " \( raw: funcName) " )
74- public func \( raw: funcName) () -> Any /* Any.Type */ {
75- return \( raw: nominal. swiftTypeName) .self
74+ public func \( raw: funcName) () -> UnsafeMutableRawPointer /* Any.Type */ {
75+ unsafeBitCast( \( raw: nominal. swiftTypeName) .self, to: UnsafeMutableRawPointer.self)
7676 }
7777 """
7878 }
@@ -89,9 +89,10 @@ struct SwiftThunkTranslator {
8989 [
9090 """
9191 @_cdecl( " \( raw: thunkName) " )
92- public func \( raw: thunkName) ( \( raw: st. renderSwiftParamDecls ( function, paramPassingStyle: nil ) ) ) -> Any /* \( raw: parent. swiftTypeName) */ {
92+ public func \( raw: thunkName) ( \( raw: st. renderSwiftParamDecls ( function, paramPassingStyle: nil ) ) ) -> UnsafeMutableRawPointer /* \( raw: parent. swiftTypeName) */ {
9393 print( " [swift] init class \( raw: parent. swiftTypeName) " )
94- return \( raw: parent. swiftTypeName) ( \( raw: st. renderForwardSwiftParams ( function, paramPassingStyle: nil ) ) )
94+ let _self = \( raw: parent. swiftTypeName) ( \( raw: st. renderForwardSwiftParams ( function, paramPassingStyle: nil ) ) )
95+ return unsafeBitCast(_self, to: UnsafeMutableRawPointer.self)
9596 }
9697 """
9798 ]
You can’t perform that action at this time.
0 commit comments