Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ink/geometry/internal/jni/partitioned_mesh_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ JNI_METHOD(geometry, PartitionedMeshNative, jlongArray,
PartitionedMeshNative_fillRenderGroupMeshPointers(native_pointer, group_index,
meshes_ptrs.data());
jlongArray mesh_pointers = env->NewLongArray(group_mesh_count);
// Both `jlong` and `int64_t` are required to be 64-bit integers which JNI and
// Kotlin-cinterop respectively both map to Kotlin `Long`. However, on MacOS
// they represent two distinct (though equivalent) types, `jlong` is `long`
// but `int64_t` is `long long`.
static_assert(sizeof(jlong) == sizeof(int64_t));
env->SetLongArrayRegion(mesh_pointers, 0, group_mesh_count,
meshes_ptrs.data());
reinterpret_cast<jlong*>(meshes_ptrs.data()));
return mesh_pointers;
}

Expand Down
19 changes: 13 additions & 6 deletions ink/jni/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ package(

cc_binary(
name = "libink.so",
additional_linker_inputs = ["jni.lds"],
features = ["-legacy_whole_archive"],
linkopts = [
# Use a linker script to limit exported symbols to JNI functions.
"-Wl,--version-script=$(location :jni.lds)",
additional_linker_inputs = [
"exported_symbols.txt",
"jni.lds",
],
features = ["-legacy_whole_archive"],
linkopts = select({
"@platforms//os:macos": [
"-Wl,-exported_symbols_list,$(location :exported_symbols.txt)",
],
"//conditions:default": [
# Use a linker script to limit exported symbols to JNI functions.
"-Wl,--version-script=$(location :jni.lds)",
],
}),
linkshared = 1,
linkstatic = 1,
deps = [
":android_all_jni",
":jni.lds",
],
)

Expand Down
2 changes: 2 additions & 0 deletions ink/jni/exported_symbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Java_*;
JNI_*;
Loading