diff --git a/java_console/.idea/runConfigurations/JniSandbox.xml b/java_console/.idea/runConfigurations/JniSandbox.xml new file mode 100644 index 0000000000..b8381a6bc0 --- /dev/null +++ b/java_console/.idea/runConfigurations/JniSandbox.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/java_console/io/src/test/java/com/rusefi/native_/JniSandbox.java b/java_console/io/src/test/java/com/rusefi/native_/JniSandbox.java new file mode 100644 index 0000000000..3811d8626d --- /dev/null +++ b/java_console/io/src/test/java/com/rusefi/native_/JniSandbox.java @@ -0,0 +1,13 @@ +package com.rusefi.native_; + +/** + * Following VM option is needed to launch: + * -Djava.library.path=../unit_tests/build + */ +public class JniSandbox { + public static void main(String[] args) { + System.loadLibrary("lib_rusefi_test"); + EngineLogic engineLogic = new EngineLogic(); + System.out.println(engineLogic.getVersion()); + } +} diff --git a/unit_tests/native/native_impl.cpp b/unit_tests/native/native_impl.cpp index 9cb69fdb3b..303d20feea 100644 --- a/unit_tests/native/native_impl.cpp +++ b/unit_tests/native/native_impl.cpp @@ -5,6 +5,13 @@ * @author Andrey Belomutskiy, (c) 2012-2022 */ +#include "pch.h" +#include "com_rusefi_native__EngineLogic.h" - +JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion(JNIEnv * env, jobject) { + const char msg[60] = "Hello from unit tests"; + const char* fileName = msg; + jstring result = env->NewStringUTF(msg); + return result; +}