Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 1.07 KB

README.md

File metadata and controls

68 lines (50 loc) · 1.07 KB

SafeCall

Safely calls an Android native function, guaranteed function crashes at most once.

Usages

Dependency

Add the following code block to the project's build.gradle or settings.gradle (gradle7.0+).

repositories {
    ...
    maven { url 'https://jitpack.io' }
}

Add the following code block to the module's build.gradle.

android {
    ...
    buildFeatures {
        prefab true
    }
}

dependencies {
    implementation 'com.github.luoyesiqiu:SafeCall:1.0.1'
}

Add following code block to CMakeLists.txt.

find_package(safecall REQUIRED CONFIG)
target_link_libraries(myapp safecall::safecall)

Includes this header file in your project.

#include "safe_call.h"

Call a has no return value function.

void problem_call() {
    //This function may throw some crashes.
    ...
}

SAFE_CALL_VOID(problem_call);

Call a has a return value function.

int problem_call(int arg) {
    //This function may throw some crashes.
    ...
    return 0;
}
int ret = 0;
SAFE_CALL(problem_call,ret,123);