diff options
author | Jerome Gaillard <jgaillard@google.com> | 2024-05-17 17:56:35 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-05-17 17:56:35 +0000 |
commit | e5ddaeeccb966b40f388f0e578e5959908be8a9f (patch) | |
tree | 4503ad2c3540eec13111a442aab50bed39aa65f9 | |
parent | 3dcba36aa77d40d15134dbf714beffb21f744808 (diff) | |
parent | 88c826d2c0b20f8c29e5549333c49fb824055e6a (diff) | |
download | libnativehelper-master.tar.gz |
-rw-r--r-- | Android.bp | 37 | ||||
-rw-r--r-- | include/nativehelper/JNIHelp.h | 5 |
2 files changed, 36 insertions, 6 deletions
@@ -102,19 +102,18 @@ cc_library_headers { min_sdk_version: "S", // 31 } -cc_library_shared { - name: "libnativehelper", +// This library contains code that is compatible with +// both ART and JVM. All code specific to ART should go +// inside libnativehelper directly. +cc_library_static { + name: "libnativehelper_any_vm", defaults: ["libnativehelper_defaults"], - bootstrap: false, host_supported: true, srcs: [ "DlHelp.c", "ExpandableString.c", "JNIHelp.c", - "JNIPlatformHelp.c", - "JniConstants.c", "JniInvocation.c", - "file_descriptor_jni.c", ], export_include_dirs: [ "header_only_include", @@ -123,6 +122,32 @@ cc_library_shared { "include_platform", "include_platform_header_only", ], + visibility: ["//frameworks/base/libs/nativehelper_jvm"], + stl: "none", + apex_available: [ + "com.android.art", + "com.android.art.debug", + ], + min_sdk_version: "S", // 31 + target: { + windows: { + enabled: true, + }, + }, +} + +cc_library_shared { + name: "libnativehelper", + defaults: ["libnativehelper_defaults"], + bootstrap: false, + host_supported: true, + srcs: [ + "JNIPlatformHelp.c", + "JniConstants.c", + "file_descriptor_jni.c", + ], + whole_static_libs: ["libnativehelper_any_vm"], + export_static_lib_headers: ["libnativehelper_any_vm"], stl: "none", stubs: { symbol_file: "libnativehelper.map.txt", diff --git a/include/nativehelper/JNIHelp.h b/include/nativehelper/JNIHelp.h index 6538ddf..f34a110 100644 --- a/include/nativehelper/JNIHelp.h +++ b/include/nativehelper/JNIHelp.h @@ -96,7 +96,12 @@ struct [[maybe_unused]] ExpandableString { } [[maybe_unused]] static const char* platformStrError(int errnum, char* buf, size_t buflen) { +#ifdef _WIN32 + strerror_s(buf, buflen, errnum); + return buf; +#else return safe_strerror(strerror_r, errnum, buf, buflen); +#endif } [[maybe_unused]] static jmethodID FindMethod(JNIEnv* env, const char* className, |