-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] Don't include
JNI_OnLoad
in `libSystem.Security.Cryptogra…
…phy.Native.Android.a` (#103231) I'm working on a feature in .NET For Android which will allow us to link all the native bits into a single shared library at application build time. In order to make it possible, no archive (`.a`) may contain any `JNI_OnLoad` functions (called by `JavaVM` when initializing a Java extension DSO), because our runtime already contains one and there Can be Only One(tm). `libSystem.Security.Cryptography.Native.Android` is currently the only BCL support native library which contains `JNI_OnLoad` and thus it prevents us from linking it into our runtime. This PR changes things a bit my moving the initialization code to a separate function (`AndroidCryptoNative_InitLibraryOnLoad `) which remains in the `.a` archive and can be called by `.NET For Android` runtime from its own `JNI_OnLoad` as well as by the `libSystem.Security.Cryptography.Native.Android.so` from its `JNI_OnLoad`, which this PR moves to a separate source file that is compiled only into the shared version of the crypto support library.
- Loading branch information
Showing
4 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/native/libs/System.Security.Cryptography.Native.Android/pal_jni_onload.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#include "pal_jni.h" | ||
|
||
JNIEXPORT jint JNICALL | ||
JNI_OnLoad(JavaVM *vm, void *reserved) | ||
{ | ||
return AndroidCryptoNative_InitLibraryOnLoad (vm, reserved); | ||
} |