From: Reino Ruusu Date: Tue, 25 Sep 2018 14:46:23 +0000 (+0300) Subject: Fixed newly created errors in FMIL native interfaces. X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F2237%2F1;p=simantics%2Ffmil.git Fixed newly created errors in FMIL native interfaces. gitlab #7 * Missing method declarations from header file. Resulted in methods exposed with C++ decorations by the DLL. * Copy-paste errors in setStringValue_(). Change-Id: I54a3957b61e9ec3a152b36596d70440cb5d2947a --- diff --git a/org.simantics.fmil.core/native/FMUSimulator/include/org_simantics_fmil_FMILJNI.h b/org.simantics.fmil.core/native/FMUSimulator/include/org_simantics_fmil_FMILJNI.h index 67e18e3..cccabf7 100644 --- a/org.simantics.fmil.core/native/FMUSimulator/include/org_simantics_fmil_FMILJNI.h +++ b/org.simantics.fmil.core/native/FMUSimulator/include/org_simantics_fmil_FMILJNI.h @@ -1,9 +1,9 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ #include -/* Header for class org_simantics_fmu_FMUControlJNI */ +/* Header for class org_simantics_fmil_core_FMIL */ -#ifndef _Included_org_simantics_fmu_FMUControlJNI -#define _Included_org_simantics_fmu_FMUControlJNI +#ifndef _Included_org_simantics_fmil_core_FMIL +#define _Included_org_simantics_fmil_core_FMIL #ifdef __cplusplus extern "C" { #endif @@ -12,7 +12,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_loadFMUFile_1 (JNIEnv *, jobject, jstring, jstring); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: setStepLength_ * Signature: (Ljava/lang/String;D)I */ @@ -20,7 +20,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setStepLength_1 (JNIEnv *, jobject, jint, jdouble); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: instantiateSimulation_ * Signature: (Ljava/lang/String;)I */ @@ -28,7 +28,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_instantiateSimulation_1 (JNIEnv *, jobject, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: initializeSimulation_ * Signature: (Ljava/lang/String;)I */ @@ -36,7 +36,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_initializeSimulation_1 (JNIEnv *, jobject, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: subscribe_ * Signature: (Ljava/lang/String;[Ljava/lang/String;I)I */ @@ -44,31 +44,39 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_subscribe_1 (JNIEnv *, jobject, jint, jintArray); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: setRealValue_ - * Signature: (Ljava/lang/String;Ljava/lang/String;D)I + * Signature: (IID)I */ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setRealValue_1 (JNIEnv *, jobject, jint, jint, jdouble); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: setIntegerValue_ - * Signature: (Ljava/lang/String;Ljava/lang/String;I)I + * Signature: (III)I */ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setIntegerValue_1 - (JNIEnv *, jobject, jstring, jstring, jint); + (JNIEnv *, jobject, jint, jint, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: setBooleanValue_ - * Signature: (Ljava/lang/String;Ljava/lang/String;Z)I + * Signature: (IIZ)I */ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setBooleanValue_1 - (JNIEnv *, jobject, jstring, jstring, jboolean); + (JNIEnv *, jobject, jint, jint, jboolean); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL + * Method: setStringValue_ + * Signature: (IILjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setStringValue_1 + (JNIEnv *, jobject, jint, jint, jstring); + +/* + * Class: org_simantics_fmil_core_FMIL * Method: setTime_ * Signature: (Ljava/lang/String;D)I */ @@ -76,7 +84,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setTime_1 (JNIEnv *, jobject, jstring, jdouble); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: simulateStep_ * Signature: (Ljava/lang/String;)I */ @@ -84,7 +92,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_simulateStep_1 (JNIEnv *, jobject, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getSubscribedResults_ * Signature: (Ljava/lang/String;[D)[D */ @@ -92,7 +100,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_simantics_fmil_core_FMIL_getSubscribedRe (JNIEnv *, jobject, jint, jdoubleArray); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: unloadFMU_ * Signature: (Ljava/lang/String;)I */ @@ -100,7 +108,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_unloadFMU_1 (JNIEnv *, jobject, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: isInitialized_ * Signature: (Ljava/lang/String;)Z */ @@ -108,7 +116,7 @@ JNIEXPORT jboolean JNICALL Java_org_simantics_fmil_core_FMIL_isInitialized_1 (JNIEnv *, jobject, jstring); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getTime_ * Signature: (Ljava/lang/String;)D */ @@ -116,7 +124,7 @@ JNIEXPORT jdouble JNICALL Java_org_simantics_fmil_core_FMIL_getTime_1 (JNIEnv *, jobject, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getAllVariables_ * Signature: (Ljava/lang/String;)[Ljava/lang/String; */ @@ -154,7 +162,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllDeclaredT (JNIEnv *, jobject, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: filterVariables_ * Signature: (Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String; */ @@ -162,7 +170,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_filterVariables (JNIEnv *, jobject, jstring, jstring); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getRealValue_ * Signature: (Ljava/lang/String;Ljava/lang/String;)D */ @@ -170,28 +178,28 @@ JNIEXPORT jdouble JNICALL Java_org_simantics_fmil_core_FMIL_getRealValue_1 (JNIEnv *, jobject, jint, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getStringValue_ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_simantics_fmil_core_FMIL_getStringValue_1 - (JNIEnv *, jobject, jstring, jstring); + (JNIEnv *, jobject, jint, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getIntegerValue_ * Signature: (Ljava/lang/String;Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_getIntegerValue_1 - (JNIEnv *, jobject, jstring, jstring); + (JNIEnv *, jobject, jint, jint); /* - * Class: org_simantics_fmu_FMUControlJNI + * Class: org_simantics_fmil_core_FMIL * Method: getBooleanValue_ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_org_simantics_fmil_core_FMIL_getBooleanValue_1 - (JNIEnv *, jobject, jstring, jstring); + (JNIEnv *, jobject, jint, jint); #ifdef __cplusplus } diff --git a/org.simantics.fmil.core/native/FMUSimulator/src/fmu_control.cpp b/org.simantics.fmil.core/native/FMUSimulator/src/fmu_control.cpp index dba9da2..ae86d2b 100644 --- a/org.simantics.fmil.core/native/FMUSimulator/src/fmu_control.cpp +++ b/org.simantics.fmil.core/native/FMUSimulator/src/fmu_control.cpp @@ -354,10 +354,10 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_setStringValue_1 const char *valueChars = env->GetStringUTFChars(value, 0); FMI1 fmi = fmus[id]; if (fmi.version == 1) { - FMI1_CS_SET_INTEGER(fmi.fmu, vr, value != 0, &error); + FMI1_CS_SET_STRING(fmi.fmu, vr, valueChars, &error); } else if (fmi.version == 2) { - FMI2_CS_SET_INTEGER(fmi.fmu, vr, value != 0, &error); + FMI2_CS_SET_STRING(fmi.fmu, vr, valueChars, &error); } env->ReleaseStringUTFChars(value, valueChars); if (!isEmpty(error)) { diff --git a/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so b/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so index d3a9097..acd2b50 100644 Binary files a/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so and b/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so differ diff --git a/org.simantics.fmil.linux64/libraries/libFMUSimulator.so b/org.simantics.fmil.linux64/libraries/libFMUSimulator.so index 2ad0e96..d244670 100644 Binary files a/org.simantics.fmil.linux64/libraries/libFMUSimulator.so and b/org.simantics.fmil.linux64/libraries/libFMUSimulator.so differ diff --git a/org.simantics.fmil.win32/libraries/FMUSimulator.dll b/org.simantics.fmil.win32/libraries/FMUSimulator.dll index 6a4486e..23d5a23 100644 Binary files a/org.simantics.fmil.win32/libraries/FMUSimulator.dll and b/org.simantics.fmil.win32/libraries/FMUSimulator.dll differ diff --git a/org.simantics.fmil.win64/libraries/FMUSimulator.dll b/org.simantics.fmil.win64/libraries/FMUSimulator.dll index e369002..9e12f65 100644 Binary files a/org.simantics.fmil.win64/libraries/FMUSimulator.dll and b/org.simantics.fmil.win64/libraries/FMUSimulator.dll differ