mirror of
https://github.com/rust-mobile/android-activity.git
synced 2026-07-04 05:47:26 +00:00
GameActivity PATCH: rename C symbols that need export
Give C symbols that need to be exported a `_C` suffix so that they can be linked into a Rust symbol with the correct name (Since we can't directly export from C/C++ with Rust+Cargo) See: https://github.com/rust-lang/rfcs/issues/2771
This commit is contained in:
@@ -485,7 +485,7 @@ static jlong initializeNativeCode_native(
|
||||
|
||||
readConfigurationValues(code, javaConfig);
|
||||
|
||||
GameActivity_onCreate(code, rawSavedState, rawSavedSize);
|
||||
GameActivity_onCreate_C(code, rawSavedState, rawSavedSize);
|
||||
|
||||
code->gameTextInput = GameTextInput_init(env, 0);
|
||||
GameTextInput_setEventCallback(code->gameTextInput,
|
||||
@@ -1130,8 +1130,12 @@ extern "C" int GameActivity_register(JNIEnv *env) {
|
||||
NELEM(g_methods));
|
||||
}
|
||||
|
||||
// XXX: This symbol is renamed with a _C suffix and then re-exported from
|
||||
// Rust because Rust/Cargo don't give us a way to directly export symbols
|
||||
// from C/C++ code: https://github.com/rust-lang/rfcs/issues/2771
|
||||
//
|
||||
extern "C" JNIEXPORT jlong JNICALL
|
||||
Java_com_google_androidgamesdk_GameActivity_initializeNativeCode(
|
||||
Java_com_google_androidgamesdk_GameActivity_initializeNativeCode_C(
|
||||
JNIEnv *env, jobject javaGameActivity, jstring internalDataDir,
|
||||
jstring obbDir, jstring externalDataDir, jobject jAssetMgr,
|
||||
jbyteArray savedState, jobject javaConfig) {
|
||||
|
||||
@@ -296,7 +296,7 @@ typedef void GameActivity_createFunc(GameActivity* activity, void* savedState,
|
||||
* "android.app.func_name" string meta-data in your manifest to use a different
|
||||
* function.
|
||||
*/
|
||||
extern GameActivity_createFunc GameActivity_onCreate;
|
||||
extern GameActivity_createFunc GameActivity_onCreate_C;
|
||||
|
||||
/**
|
||||
* Finish the given activity. Its finish() method will be called, causing it
|
||||
|
||||
+5
-2
@@ -616,9 +616,12 @@ static void onContentRectChanged(GameActivity* activity, const ARect *rect) {
|
||||
pthread_mutex_unlock(&android_app->mutex);
|
||||
}
|
||||
|
||||
|
||||
// XXX: This symbol is renamed with a _C suffix and then re-exported from
|
||||
// Rust because Rust/Cargo don't give us a way to directly export symbols
|
||||
// from C/C++ code: https://github.com/rust-lang/rfcs/issues/2771
|
||||
//
|
||||
JNIEXPORT
|
||||
void GameActivity_onCreate(GameActivity* activity, void* savedState,
|
||||
void GameActivity_onCreate_C(GameActivity* activity, void* savedState,
|
||||
size_t savedStateSize) {
|
||||
LOGV("Creating: %p", activity);
|
||||
activity->callbacks->onDestroy = onDestroy;
|
||||
|
||||
Reference in New Issue
Block a user