Skip to content

Commit dc3411d

Browse files
committed
Make JNI handling of Int/UInt match FFM mode.
1 parent 6a75aeb commit dc3411d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Sources/JExtractSwiftLib/JNI/JNIJavaTypeTranslator.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ enum JNIJavaTypeTranslator {
4040
case .int64: return .long
4141
case .uint64: return .long
4242

43+
// FIXME: 32 bit consideration.
44+
// The 'FunctionDescriptor' uses 'SWIFT_INT' which relies on the running
45+
// machine arch. That means users can't pass Java 'long' values to the
46+
// function without casting. But how do we generate code that runs both
47+
// 32 and 64 bit machine?
48+
case .int, .uint: return .long
49+
4350
case .float: return .float
4451
case .double: return .double
4552
case .void: return .void
4653

4754
case .string: return .javaLangString
4855

49-
case .int, .uint, // FIXME: why not supported int/uint?
50-
.unsafeRawPointer, .unsafeMutableRawPointer,
56+
case .unsafeRawPointer, .unsafeMutableRawPointer,
5157
.unsafePointer, .unsafeMutablePointer,
5258
.unsafeRawBufferPointer, .unsafeMutableRawBufferPointer,
5359
.unsafeBufferPointer, .unsafeMutableBufferPointer,

0 commit comments

Comments
 (0)