]> gerrit.simantics Code Review - simantics/fmil.git/commitdiff
Linux 64 support for FMU 00/1700/1 release/1.34.0 release/1.34.2
authormeklund <miro.eklund@semantum.fi>
Tue, 10 Apr 2018 14:00:47 +0000 (17:00 +0300)
committermeklund <miro.eklund@semantum.fi>
Tue, 10 Apr 2018 14:00:47 +0000 (17:00 +0300)
Refactored a lot of c and cpp code to allow both Windows and Linux
builds.

Added a Dockerfile and shellscripts that automatically builds the FMI
base library and FMUSimulator for us in .so format, as well as updates
them with "patchelf" program to properly find each-other.

Removed the previous Dockerfile, which only built the FMI library
without taking our code into account.

Updated all .so files to reflect changes made here.

Updated README

refs #7862

Change-Id: Ibfab64c67030825cbed763762354bacbe8884ad3

28 files changed:
org.simantics.fmil.core/Dockerfile [new file with mode: 0644]
org.simantics.fmil.core/README.md
org.simantics.fmil.core/linuxbuild/copytovolume.sh [moved from org.simantics.fmil.linux64/DockerFile/copytovolume.sh with 65% similarity]
org.simantics.fmil.core/linuxbuild/linuxbuild.sh [new file with mode: 0755]
org.simantics.fmil.core/linuxbuild/linuxdebugbuild.sh [new file with mode: 0755]
org.simantics.fmil.core/native/FMUSimulator/fmi_util.c.txt
org.simantics.fmil.core/native/FMUSimulator/include/fmi1_cs.h
org.simantics.fmil.core/native/FMUSimulator/include/fmi_me.h
org.simantics.fmil.core/native/FMUSimulator/include/jni.h
org.simantics.fmil.core/native/FMUSimulator/include/linux/jni_md.h [new file with mode: 0644]
org.simantics.fmil.core/native/FMUSimulator/include/sim_support.h
org.simantics.fmil.core/native/FMUSimulator/include/win32/jni_md.h [moved from org.simantics.fmil.core/native/FMUSimulator/include/jni_md.h with 100% similarity]
org.simantics.fmil.core/native/FMUSimulator/src/fmu_control.cpp
org.simantics.fmil.core/native/FMUSimulator/src/sim_support.c
org.simantics.fmil.core/src/org/simantics/fmil/core/FMIL.java
org.simantics.fmil.linux64/DockerFile/Dockerfile [deleted file]
org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so [new file with mode: 0755]
org.simantics.fmil.linux64/libraries/debug/libfmilib_shared.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/debug/libfmu1_dll_cs.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/debug/libfmu1_dll_me.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/debug/libfmu2_dll_cs.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/debug/libfmu2_dll_me.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/libFMUSimulator.so [new file with mode: 0755]
org.simantics.fmil.linux64/libraries/libfmilib_shared.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/libfmu1_dll_cs.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/libfmu1_dll_me.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/libfmu2_dll_cs.so [changed mode: 0644->0755]
org.simantics.fmil.linux64/libraries/libfmu2_dll_me.so [changed mode: 0644->0755]

diff --git a/org.simantics.fmil.core/Dockerfile b/org.simantics.fmil.core/Dockerfile
new file mode 100644 (file)
index 0000000..6e917ec
--- /dev/null
@@ -0,0 +1,62 @@
+#First build it:
+#docker build -f Dockerfile -t fmilibrary:build .
+#Then COPY the .so files (and logs) to your org.simantics.fmil.linux64:
+#docker run -v /path/to/org.simantics.fmil.linux64/libraries:/output fmilibrary:build
+
+FROM ubuntu:16.04
+
+MAINTAINER miro.eklund@semantum.fi
+
+ARG fmi='http://www.jmodelica.org/downloads/FMIL/FMILibrary-2.0.3-src.zip'
+
+RUN apt-get update && \
+       apt-get -y upgrade
+
+RUN apt-get install -y wget cmake unzip build-essential patchelf
+
+RUN mkdir /builds && \
+       mkdir /builds/fmilsrc && \
+       mkdir /builds/fmil && \
+       mkdir /builds/fmildebug
+
+RUN wget -O /builds/fmilsrc/fmil.zip $fmi
+
+WORKDIR /builds/fmilsrc
+
+RUN unzip /builds/fmilsrc/fmil.zip && \
+       rm /builds/fmilsrc/fmil.zip
+
+WORKDIR /builds/fmil
+
+RUN rm /builds/fmilsrc/FMILibrary-2.0.3/src/Util/src/FMI/fmi_util.c
+COPY /native/FMUSimulator/fmi_util.c.txt /builds/fmilsrc/FMILibrary-2.0.3/src/Util/src/FMI/fmi_util.c
+
+RUN cat /builds/fmilsrc/FMILibrary-2.0.3/src/Util/src/FMI/fmi_util.c
+
+RUN cmake /builds/fmilsrc/FMILibrary-2.0.3 >> /fmil.log 2>&1
+
+RUN make >> /fmil.log 2>&1
+RUN make install test >> /fmil.log 2>&1
+
+WORKDIR /builds/fmildebug
+
+RUN cmake -DFMILIB_ENABLE_LOG_LEVEL_DEBUG=ON /builds/fmilsrc/FMILibrary-2.0.3 >> /fmildebug.log 2>&1
+
+RUN make >> /fmildebug.log 2>&1
+RUN make install test >> /fmildebug.log 2>&1
+
+COPY native /builds/native
+WORKDIR /builds/native/FMUSimulator
+
+COPY ./linuxbuild/copytovolume.sh /copytovolume.sh
+COPY ./linuxbuild/linuxbuild.sh /linuxbuild.sh
+COPY ./linuxbuild/linuxdebugbuild.sh /linuxdebugbuild.sh
+
+RUN chmod 755 /linuxbuild.sh && \
+       chmod 755 /linuxdebugbuild.sh
+
+RUN /linuxbuild.sh >> /builds/native/fmusimulator.log 2>&1
+RUN /linuxdebugbuild.sh >> /builds/native/fmusimulatordebug.log 2>&1
+
+RUN chmod 755 /copytovolume.sh
+ENTRYPOINT /copytovolume.sh
index e132c0db5d93f606c74d9cd616fda04fdaff87dc..46d611bc2dfbc26885112a40718d7a3807b01413 100644 (file)
@@ -2,4 +2,10 @@
 
 CMake GUI for generating Visual Studio project files from FMILibrary sources
 
-Remember to manually delete CMakeCache and CMakeFiles from FMILibrary/build/expatex/-folder 
\ No newline at end of file
+Remember to manually delete CMakeCache and CMakeFiles from FMILibrary/build/expatex/-folder 
+
+NOTE:
+       
+When building the libfmilib_shared.so, we need to replace fmi_util.c file under "<path to FMILibrary>/src/Util/src/FMI/fmi_util.c" with contents of fmi_util.c.txt, located
+under /native/FMUSimulator/fmi_util.c.txt. The Dockerfile already does this so if you build the libfmilib_shared.so with that, then you needn't worry about this.
\ No newline at end of file
similarity index 65%
rename from org.simantics.fmil.linux64/DockerFile/copytovolume.sh
rename to org.simantics.fmil.core/linuxbuild/copytovolume.sh
index f05214d138e371a6e6209c83255d0aceb276c0d7..db01c0246029c2bf11d1d09c2c3e22cd069e4347 100644 (file)
@@ -1,15 +1,25 @@
 #!/bin/bash
+
+echo Preparing directories
 mkdir /output
 mkdir /output/debug
+
+echo Copying logs
 cp /fmildebug.log /output/debug/fmildebug.log
 cp /fmil.log /output/fmil.log
+cp /builds/native/fmusimulator.log /output/fmusimulator.log
+cp /builds/native/fmusimulatordebug.log /output/debug/fmusimulatordebug.log
 
+echo Copying non-debug shared objects
+cp /builds/native/FMUSimulator/libFMUSimulator.so /output/libFMUSimulator.so
 cp /builds/fmil/libfmu1_dll_me.so /output/libfmu1_dll_me.so
 cp /builds/fmil/libfmu2_dll_me.so /output/libfmu2_dll_me.so
 cp /builds/fmil/libfmu1_dll_cs.so /output/libfmu1_dll_cs.so
 cp /builds/fmil/libfmu2_dll_cs.so /output/libfmu2_dll_cs.so
 cp /builds/fmil/libfmilib_shared.so /output/libfmilib_shared.so
 
+echo Copying debug shared objects
+cp /builds/native/FMUSimulator/libFMUSimulatorDebug.so /output/debug/libFMUSimulator.so
 cp /builds/fmildebug/libfmu1_dll_me.so /output/debug/libfmu1_dll_me.so
 cp /builds/fmildebug/libfmu2_dll_me.so /output/debug/libfmu2_dll_me.so
 cp /builds/fmildebug/libfmu1_dll_cs.so /output/debug/libfmu1_dll_cs.so
diff --git a/org.simantics.fmil.core/linuxbuild/linuxbuild.sh b/org.simantics.fmil.core/linuxbuild/linuxbuild.sh
new file mode 100755 (executable)
index 0000000..37a9673
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+CPPFLAGS="-fPIC -ggdb -std=c++11 -Wall -pedantic -Wno-switch -Wno-unused-function -Iinclude -Iinclude/linux"
+LDFLAGS="-L/builds/fmil/ -lfmilib_shared"
+
+rm -rf obj
+mkdir obj
+g++ ${CPPFLAGS} -o obj/fmu_control.o -c src/fmu_control.cpp
+g++ ${CPPFLAGS} -o obj/sim_support.o -c src/sim_support.c
+g++ ${CPPFLAGS} -o obj/stack.o -c src/stack.c
+
+g++ -ggdb -shared -Wl,-soname,libFMUSimulator.so -o libFMUSimulator.so obj/fmu_control.o obj/sim_support.o obj/stack.o ${LDFLAGS}
+
+patchelf --add-needed libfmilib_shared.so libFMUSimulator.so
+patchelf --set-rpath \$ORIGIN libFMUSimulator.so
\ No newline at end of file
diff --git a/org.simantics.fmil.core/linuxbuild/linuxdebugbuild.sh b/org.simantics.fmil.core/linuxbuild/linuxdebugbuild.sh
new file mode 100755 (executable)
index 0000000..048cc2f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+CPPFLAGS="-fPIC -ggdb -std=c++11 -Wall -pedantic -Wno-switch -Wno-unused-function -Iinclude -Iinclude/linux"
+LDFLAGS="-L/builds/fmildebug/ -lfmilib_shared"
+
+rm -rf obj
+mkdir obj
+g++ ${CPPFLAGS} -o obj/fmu_control.o -c src/fmu_control.cpp 
+g++ ${CPPFLAGS} -o obj/sim_support.o -c src/sim_support.c
+g++ ${CPPFLAGS} -o obj/stack.o -c src/stack.c
+
+g++ -ggdb -shared -Wl,-soname,libFMUSimulatorDebug.so -o libFMUSimulatorDebug.so obj/fmu_control.o obj/sim_support.o obj/stack.o ${LDFLAGS}
+
+patchelf --add-needed libfmilib_shared.so libFMUSimulator.so
+patchelf --set-rpath \$ORIGIN libFMUSimulator.so
\ No newline at end of file
index 7b90df5be85b8bb4560cc19594a8cc36456fb2ac..bfd6e203a552bb8144e48862945e32b5e3ce9180 100644 (file)
@@ -19,6 +19,7 @@
 #include <FMI/fmi_util.h>
 #include <FMI/fmi_zip_unzip.h>
 
+
 char* fmi_construct_dll_dir_name(jm_callbacks* callbacks, const char* fmu_unzipped_path) {
        char* dir_path;
        size_t len;
@@ -59,8 +60,6 @@ char* fmi_construct_dll_file_name(jm_callbacks* callbacks, const char* dll_dir_n
        return fname;
 }
 
-////
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -78,23 +77,23 @@ typedef struct {
        char *description;
        char *declaredType;
        long vr;
-       // 0 = real
+       /* 0 = real
        // 1 = integer
        // 2 = boolean
        // 3 = string
-       // 4 = enumeration
+       // 4 = enumeration */
        int type;
-       // 0 = constant
+       /* 0 = constant
        // 1 = parameter
        // 2 = discrete
        // 3 = continuous
-       // 4 = unknown
+       // 4 = unknown */
        int variability;
-       // 0 = input
+       /* 0 = input
        // 1 = output
        // 2 = internal
        // 3 = none
-       // 4 = unknown
+       // 4 = unknown */
        int causality;
 } FMIL_Variable;
 
@@ -105,27 +104,37 @@ typedef struct {
        char *unit;
 } FMIL_DeclaredType;
 
-__declspec(dllexport) int FMI_CS_LOAD(const char *zipFilePath, const char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error);
-
-__declspec(dllexport) int FMI1_CS_UNLOAD(void* fmu, const char **error);
-__declspec(dllexport) FMIL_Variable *FMI1_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
-__declspec(dllexport) FMIL_DeclaredType *FMI1_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
-__declspec(dllexport) int FMI1_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
-__declspec(dllexport) int FMI1_CS_INITIALIZE(void* fmu, const char **error);
-__declspec(dllexport) int FMI1_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
-__declspec(dllexport) int FMI1_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
-__declspec(dllexport) double FMI1_CS_GET_REAL(void* fmu, int vr, const char **error);
-__declspec(dllexport) int FMI1_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
-
-__declspec(dllexport) int FMI2_CS_UNLOAD(void* fmu, const char **error);
-__declspec(dllexport) FMIL_Variable *FMI2_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
-__declspec(dllexport) FMIL_DeclaredType *FMI2_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
-__declspec(dllexport) int FMI2_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
-__declspec(dllexport) int FMI2_CS_INITIALIZE(void* fmu, const char **error);
-__declspec(dllexport) int FMI2_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
-__declspec(dllexport) int FMI2_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
-__declspec(dllexport) double FMI2_CS_GET_REAL(void* fmu, int vr, const char **error);
-__declspec(dllexport) int FMI2_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
+#ifdef _MSC_VER
+#define DLLEXPORT __declspec(dllexport)
+#elif __GNUC__
+#define DLLEXPORT __attribute__((visibility("default")))
+#pragma warning Using GNUC default visibility
+#else
+#define DLLEXPORT
+#pragma warning Empty dynamic link EXPORT defined
+#endif
+
+DLLEXPORT int FMI_CS_LOAD(const char *zipFilePath, const char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error);
+
+DLLEXPORT int FMI1_CS_UNLOAD(void* fmu, const char **error);
+DLLEXPORT FMIL_Variable *FMI1_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
+DLLEXPORT FMIL_DeclaredType *FMI1_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
+DLLEXPORT int FMI1_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
+DLLEXPORT int FMI1_CS_INITIALIZE(void* fmu, const char **error);
+DLLEXPORT int FMI1_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
+DLLEXPORT int FMI1_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
+DLLEXPORT double FMI1_CS_GET_REAL(void* fmu, int vr, const char **error);
+DLLEXPORT int FMI1_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
+
+DLLEXPORT int FMI2_CS_UNLOAD(void* fmu, const char **error);
+DLLEXPORT FMIL_Variable *FMI2_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
+DLLEXPORT FMIL_DeclaredType *FMI2_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
+DLLEXPORT int FMI2_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
+DLLEXPORT int FMI2_CS_INITIALIZE(void* fmu, const char **error);
+DLLEXPORT int FMI2_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
+DLLEXPORT int FMI2_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
+DLLEXPORT double FMI2_CS_GET_REAL(void* fmu, int vr, const char **error);
+DLLEXPORT int FMI2_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
 
 #ifdef __cplusplus
 }
@@ -153,7 +162,7 @@ void fmilogger(fmi1_component_t c, fmi1_string_t instanceName, fmi1_status_t sta
     }*/
 }
 
-int FMI_CS_LOAD(char *zipFilePath, char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error) {
+int FMI_CS_LOAD(const char *zipFilePath, const char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error) {
 
        fmi1_callback_functions_t callBackFunctions;
        fmi2_callback_functions_t callBackFunctions2;
@@ -182,7 +191,7 @@ int FMI_CS_LOAD(char *zipFilePath, char *unzipFolder, void **fmuPointer, int *fm
                fmu = fmi1_import_parse_xml(context, unzipFolder);
                if (fmi1_import_get_fmu_kind(fmu) != fmi1_fmu_kind_enu_cs_standalone && fmi1_import_get_fmu_kind(fmu) != fmi1_fmu_kind_enu_cs_tool) {
                        *error = "Provided FMU is version 1 but wrong type me (Model Exchange) when it should be cs (Co-Simulation)";
-                       return 2; // wrong type, should be co-simulation
+                       return 2; /* wrong type, should be co-simulation */
                }
                
                callBackFunctions.logger = fmilogger;
@@ -202,7 +211,7 @@ int FMI_CS_LOAD(char *zipFilePath, char *unzipFolder, void **fmuPointer, int *fm
 
                if (fmi2_import_get_fmu_kind(fmu2) != fmi1_fmu_kind_enu_cs_standalone && fmi2_import_get_fmu_kind(fmu2) != fmi1_fmu_kind_enu_cs_tool) {
                        *error = "Provided FMU is version 2.0 but wrong type me (Model Exchange) when it should be cs (Co-Simulation)";
-                       return 2; // wrong type, should be co-simulation
+                       return 2; /* wrong type, should be co-simulation */
                }
 
                callBackFunctions2.logger = fmi2_log_forwarding;
@@ -222,7 +231,7 @@ int FMI_CS_LOAD(char *zipFilePath, char *unzipFolder, void **fmuPointer, int *fm
        
        fmi_import_free_context(context);
 
-       return 0; // success
+       return 0; /* success */
 }
 
 int FMI1_CS_UNLOAD(void *fmu_, const char **error) {
@@ -703,7 +712,7 @@ int FMI2_CS_STEP(void *fmu, double masterTime, double stepSize, const char **err
        return 0;
 }
 
-int FMI1_CS_SET_REAL(void *fmu, long valueId, double value, const char **error) {
+int FMI1_CS_SET_REAL(void *fmu, int valueId, double value, const char **error) {
 
        fmi1_status_t status;
 
@@ -716,7 +725,7 @@ int FMI1_CS_SET_REAL(void *fmu, long valueId, double value, const char **error)
        return 0;
 }
 
-int FMI2_CS_SET_REAL(void *fmu, long valueId, double value, const char **error) {
+int FMI2_CS_SET_REAL(void *fmu, int valueId, double value, const char **error) {
 
        fmi2_status_t status;
 
@@ -759,7 +768,7 @@ double FMI2_CS_GET_REAL(void *fmu, int valueReference, const char **error) {
 
 int FMI1_CS_GET_REALS(void *fmu, int *valueReferences, double *result, int count, const char **error) {
 
-       fmi1_value_reference_t *vrs = valueReferences;
+       fmi1_value_reference_t *vrs = (fmi1_value_reference_t*) valueReferences;
        fmi1_real_t value;
 
        fmi1_status_t status;
@@ -773,7 +782,7 @@ int FMI1_CS_GET_REALS(void *fmu, int *valueReferences, double *result, int count
 
 int FMI2_CS_GET_REALS(void *fmu, int *valueReferences, double *result, int count, const char **error) {
 
-       fmi2_value_reference_t *vrs = valueReferences;
+       fmi2_value_reference_t *vrs = (fmi2_value_reference_t*) valueReferences;
        fmi2_real_t value;
 
        fmi2_status_t status;
index 40d942b15f531e2d64b2b9ccf7a13dae7409cfbe..970402277a258e89073e000638af5fa0e2a4d0db 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#ifdef _MSC_VER
+#define DLLEXPORT __declspec(dllexport)
+#else
+#define DLLEXPORT
+#endif
+
 typedef struct {
        char *name;
        char *description;
@@ -37,30 +43,30 @@ typedef struct {
        char *unit;
 } FMIL_DeclaredType;
 
-__declspec(dllexport) int FMI_CS_LOAD(const char *zipFilePath, const char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error);
+DLLEXPORT int FMI_CS_LOAD(const char *zipFilePath, const char *unzipFolder, void **fmuPointer, int *fmuVersion, const char **error);
 
-__declspec(dllexport) int FMI1_CS_UNLOAD(void* fmu, const char **error);
-__declspec(dllexport) FMIL_Variable *FMI1_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
-__declspec(dllexport) FMIL_DeclaredType *FMI1_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
-__declspec(dllexport) int FMI1_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
-__declspec(dllexport) int FMI1_CS_INITIALIZE(void* fmu, const char **error);
-__declspec(dllexport) int FMI1_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
-__declspec(dllexport) int FMI1_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
-__declspec(dllexport) double FMI1_CS_GET_REAL(void* fmu, int vr, const char **error);
-__declspec(dllexport) int FMI1_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
+DLLEXPORT int FMI1_CS_UNLOAD(void* fmu, const char **error);
+DLLEXPORT FMIL_Variable *FMI1_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
+DLLEXPORT FMIL_DeclaredType *FMI1_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
+DLLEXPORT int FMI1_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
+DLLEXPORT int FMI1_CS_INITIALIZE(void* fmu, const char **error);
+DLLEXPORT int FMI1_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
+DLLEXPORT int FMI1_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
+DLLEXPORT double FMI1_CS_GET_REAL(void* fmu, int vr, const char **error);
+DLLEXPORT int FMI1_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
 
-__declspec(dllexport) int FMI2_CS_UNLOAD(void* fmu, const char **error);
-__declspec(dllexport) FMIL_Variable *FMI2_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
-__declspec(dllexport) FMIL_DeclaredType *FMI2_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
-__declspec(dllexport) int FMI2_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
-__declspec(dllexport) int FMI2_CS_INITIALIZE(void* fmu, const char **error);
-__declspec(dllexport) int FMI2_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
-__declspec(dllexport) int FMI2_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
-__declspec(dllexport) double FMI2_CS_GET_REAL(void* fmu, int vr, const char **error);
-__declspec(dllexport) int FMI2_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
+DLLEXPORT int FMI2_CS_UNLOAD(void* fmu, const char **error);
+DLLEXPORT FMIL_Variable *FMI2_CS_GET_VARIABLES(void* fmu, int *count, const char **error);
+DLLEXPORT FMIL_DeclaredType *FMI2_CS_GET_DECLARED_TYPES(void* fmu, int *count, const char **error);
+DLLEXPORT int FMI2_CS_INSTANTIATE(void* fmu, const char *instanceName, const char **error);
+DLLEXPORT int FMI2_CS_INITIALIZE(void* fmu, const char **error);
+DLLEXPORT int FMI2_CS_STEP(void* fmu, double masterTime, double stepSize, const char **error);
+DLLEXPORT int FMI2_CS_SET_REAL(void* fmu, int vr, double value, const char **error);
+DLLEXPORT double FMI2_CS_GET_REAL(void* fmu, int vr, const char **error);
+DLLEXPORT int FMI2_CS_GET_REALS(void* fmu, int *vrs, double *values, int count, const char **error);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif
\ No newline at end of file
+#endif // __FMI1_CS_H__
index f1152455c25af3b94a62e8b7234c55ee69dd6970..4698b460f29a2b2ecd1c502f3ea68e45af544687 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef FMI_ME_H\r
 #define FMI_ME_H\r
 \r
-#include <windows.h>\r
 #include "fmiModelFunctions.h"\r
 #include "xml_parser.h"\r
 \r
@@ -42,7 +41,7 @@ typedef fmiStatus (*fTerminate)                 (fmiComponent c);
 \r
 typedef struct {\r
     ModelDescription* modelDescription;\r
-    HANDLE dllHandle;\r
+    void* dllHandle;\r
     fGetModelTypesPlatform getModelTypesPlatform;\r
     fGetVersion getVersion;\r
     fInstantiateModel instantiateModel;\r
index 8ed7366ad877e150c823ce707b64978bdbc01869..0ffe244b6a2996a131cfe71ed82e15f3d5a570b0 100644 (file)
@@ -1,8 +1,26 @@
 /*
- * %W% %E%
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
  *
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * ORACLE PROPRIETARY/CONFIDENTIAL.  Use is subject to license terms.
  */
 
 /*
@@ -36,11 +54,11 @@ extern "C" {
 
 #ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
 
-typedef unsigned char  jboolean;
-typedef unsigned short jchar;
-typedef short          jshort;
-typedef float          jfloat;
-typedef double         jdouble;
+typedef unsigned char   jboolean;
+typedef unsigned short  jchar;
+typedef short           jshort;
+typedef float           jfloat;
+typedef double          jdouble;
 
 typedef jint            jsize;
 
@@ -122,7 +140,7 @@ typedef enum _jobjectType {
      JNIInvalidRefType    = 0,
      JNILocalRefType      = 1,
      JNIGlobalRefType     = 2,
-     JNIWeakGlobalRefType = 3 
+     JNIWeakGlobalRefType = 3
 } jobjectRefType;
 
 
@@ -769,7 +787,7 @@ struct JNIEnv_ {
         return functions->GetVersion(this);
     }
     jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
-                      jsize len) {
+                       jsize len) {
         return functions->DefineClass(this, name, loader, buf, len);
     }
     jclass FindClass(const char *name) {
@@ -849,18 +867,18 @@ struct JNIEnv_ {
     }
     jobject NewObject(jclass clazz, jmethodID methodID, ...) {
         va_list args;
-       jobject result;
-       va_start(args, methodID);
+        jobject result;
+        va_start(args, methodID);
         result = functions->NewObjectV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        va_end(args);
+        return result;
     }
     jobject NewObjectV(jclass clazz, jmethodID methodID,
-                      va_list args) {
+                       va_list args) {
         return functions->NewObjectV(this,clazz,methodID,args);
     }
     jobject NewObjectA(jclass clazz, jmethodID methodID,
-                      const jvalue *args) {
+                       const jvalue *args) {
         return functions->NewObjectA(this,clazz,methodID,args);
     }
 
@@ -872,392 +890,392 @@ struct JNIEnv_ {
     }
 
     jmethodID GetMethodID(jclass clazz, const char *name,
-                         const char *sig) {
+                          const char *sig) {
         return functions->GetMethodID(this,clazz,name,sig);
     }
 
     jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jobject result;
-       va_start(args,methodID);
-       result = functions->CallObjectMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jobject result;
+        va_start(args,methodID);
+        result = functions->CallObjectMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jobject CallObjectMethodV(jobject obj, jmethodID methodID,
-                       va_list args) {
+                        va_list args) {
         return functions->CallObjectMethodV(this,obj,methodID,args);
     }
     jobject CallObjectMethodA(jobject obj, jmethodID methodID,
-                       const jvalue * args) {
+                        const jvalue * args) {
         return functions->CallObjectMethodA(this,obj,methodID,args);
     }
 
     jboolean CallBooleanMethod(jobject obj,
-                              jmethodID methodID, ...) {
+                               jmethodID methodID, ...) {
         va_list args;
-       jboolean result;
-       va_start(args,methodID);
-       result = functions->CallBooleanMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jboolean result;
+        va_start(args,methodID);
+        result = functions->CallBooleanMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
-                               va_list args) {
+                                va_list args) {
         return functions->CallBooleanMethodV(this,obj,methodID,args);
     }
     jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
-                               const jvalue * args) {
+                                const jvalue * args) {
         return functions->CallBooleanMethodA(this,obj,methodID, args);
     }
 
     jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jbyte result;
-       va_start(args,methodID);
-       result = functions->CallByteMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jbyte result;
+        va_start(args,methodID);
+        result = functions->CallByteMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jbyte CallByteMethodV(jobject obj, jmethodID methodID,
-                         va_list args) {
+                          va_list args) {
         return functions->CallByteMethodV(this,obj,methodID,args);
     }
     jbyte CallByteMethodA(jobject obj, jmethodID methodID,
-                         const jvalue * args) {
+                          const jvalue * args) {
         return functions->CallByteMethodA(this,obj,methodID,args);
     }
 
     jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jchar result;
-       va_start(args,methodID);
-       result = functions->CallCharMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jchar result;
+        va_start(args,methodID);
+        result = functions->CallCharMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jchar CallCharMethodV(jobject obj, jmethodID methodID,
-                         va_list args) {
+                          va_list args) {
         return functions->CallCharMethodV(this,obj,methodID,args);
     }
     jchar CallCharMethodA(jobject obj, jmethodID methodID,
-                         const jvalue * args) {
+                          const jvalue * args) {
         return functions->CallCharMethodA(this,obj,methodID,args);
     }
 
     jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jshort result;
-       va_start(args,methodID);
-       result = functions->CallShortMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jshort result;
+        va_start(args,methodID);
+        result = functions->CallShortMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jshort CallShortMethodV(jobject obj, jmethodID methodID,
-                           va_list args) {
+                            va_list args) {
         return functions->CallShortMethodV(this,obj,methodID,args);
     }
     jshort CallShortMethodA(jobject obj, jmethodID methodID,
-                           const jvalue * args) {
+                            const jvalue * args) {
         return functions->CallShortMethodA(this,obj,methodID,args);
     }
 
     jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jint result;
-       va_start(args,methodID);
-       result = functions->CallIntMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jint result;
+        va_start(args,methodID);
+        result = functions->CallIntMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jint CallIntMethodV(jobject obj, jmethodID methodID,
-                       va_list args) {
+                        va_list args) {
         return functions->CallIntMethodV(this,obj,methodID,args);
     }
     jint CallIntMethodA(jobject obj, jmethodID methodID,
-                       const jvalue * args) {
+                        const jvalue * args) {
         return functions->CallIntMethodA(this,obj,methodID,args);
     }
 
     jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jlong result;
-       va_start(args,methodID);
-       result = functions->CallLongMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jlong result;
+        va_start(args,methodID);
+        result = functions->CallLongMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jlong CallLongMethodV(jobject obj, jmethodID methodID,
-                         va_list args) {
+                          va_list args) {
         return functions->CallLongMethodV(this,obj,methodID,args);
     }
     jlong CallLongMethodA(jobject obj, jmethodID methodID,
-                         const jvalue * args) {
+                          const jvalue * args) {
         return functions->CallLongMethodA(this,obj,methodID,args);
     }
 
     jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jfloat result;
-       va_start(args,methodID);
-       result = functions->CallFloatMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jfloat result;
+        va_start(args,methodID);
+        result = functions->CallFloatMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
-                           va_list args) {
+                            va_list args) {
         return functions->CallFloatMethodV(this,obj,methodID,args);
     }
     jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
-                           const jvalue * args) {
+                            const jvalue * args) {
         return functions->CallFloatMethodA(this,obj,methodID,args);
     }
 
     jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       jdouble result;
-       va_start(args,methodID);
-       result = functions->CallDoubleMethodV(this,obj,methodID,args);
-       va_end(args);
-       return result;
+        jdouble result;
+        va_start(args,methodID);
+        result = functions->CallDoubleMethodV(this,obj,methodID,args);
+        va_end(args);
+        return result;
     }
     jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
-                       va_list args) {
+                        va_list args) {
         return functions->CallDoubleMethodV(this,obj,methodID,args);
     }
     jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
-                       const jvalue * args) {
+                        const jvalue * args) {
         return functions->CallDoubleMethodA(this,obj,methodID,args);
     }
 
     void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
         va_list args;
-       va_start(args,methodID);
-       functions->CallVoidMethodV(this,obj,methodID,args);
-       va_end(args);
+        va_start(args,methodID);
+        functions->CallVoidMethodV(this,obj,methodID,args);
+        va_end(args);
     }
     void CallVoidMethodV(jobject obj, jmethodID methodID,
-                        va_list args) {
+                         va_list args) {
         functions->CallVoidMethodV(this,obj,methodID,args);
     }
     void CallVoidMethodA(jobject obj, jmethodID methodID,
-                        const jvalue * args) {
+                         const jvalue * args) {
         functions->CallVoidMethodA(this,obj,methodID,args);
     }
 
     jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
-                                      jmethodID methodID, ...) {
+                                       jmethodID methodID, ...) {
         va_list args;
-       jobject result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
-                                                       methodID,args);
-       va_end(args);
-       return result;
+        jobject result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+                                                        methodID,args);
+        va_end(args);
+        return result;
     }
     jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
-                                       jmethodID methodID, va_list args) {
+                                        jmethodID methodID, va_list args) {
         return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
-                                                     methodID,args);
+                                                      methodID,args);
     }
     jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
-                                       jmethodID methodID, const jvalue * args) {
+                                        jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
-                                                     methodID,args);
+                                                      methodID,args);
     }
 
     jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
-                                        jmethodID methodID, ...) {
+                                         jmethodID methodID, ...) {
         va_list args;
-       jboolean result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
-                                                        methodID,args);
-       va_end(args);
-       return result;
+        jboolean result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+                                                         methodID,args);
+        va_end(args);
+        return result;
     }
     jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
-                                         jmethodID methodID, va_list args) {
+                                          jmethodID methodID, va_list args) {
         return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
-                                                      methodID,args);
+                                                       methodID,args);
     }
     jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
-                                         jmethodID methodID, const jvalue * args) {
+                                          jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
-                                                      methodID, args);
+                                                       methodID, args);
     }
 
     jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
-                                  jmethodID methodID, ...) {
+                                   jmethodID methodID, ...) {
         va_list args;
-       jbyte result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
-                                                     methodID,args);
-       va_end(args);
-       return result;
+        jbyte result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
+                                                      methodID,args);
+        va_end(args);
+        return result;
     }
     jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
-                                   jmethodID methodID, va_list args) {
+                                    jmethodID methodID, va_list args) {
         return functions->CallNonvirtualByteMethodV(this,obj,clazz,
-                                                   methodID,args);
+                                                    methodID,args);
     }
     jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
-                                   jmethodID methodID, const jvalue * args) {
+                                    jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualByteMethodA(this,obj,clazz,
-                                                   methodID,args);
+                                                    methodID,args);
     }
 
     jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
-                                  jmethodID methodID, ...) {
+                                   jmethodID methodID, ...) {
         va_list args;
-       jchar result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
-                                                     methodID,args);
-       va_end(args);
-       return result;
+        jchar result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
+                                                      methodID,args);
+        va_end(args);
+        return result;
     }
     jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
-                                   jmethodID methodID, va_list args) {
+                                    jmethodID methodID, va_list args) {
         return functions->CallNonvirtualCharMethodV(this,obj,clazz,
-                                                   methodID,args);
+                                                    methodID,args);
     }
     jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
-                                   jmethodID methodID, const jvalue * args) {
+                                    jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualCharMethodA(this,obj,clazz,
-                                                   methodID,args);
+                                                    methodID,args);
     }
 
     jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
-                                    jmethodID methodID, ...) {
+                                     jmethodID methodID, ...) {
         va_list args;
-       jshort result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
-                                                      methodID,args);
-       va_end(args);
-       return result;
+        jshort result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
+                                                       methodID,args);
+        va_end(args);
+        return result;
     }
     jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
-                                     jmethodID methodID, va_list args) {
+                                      jmethodID methodID, va_list args) {
         return functions->CallNonvirtualShortMethodV(this,obj,clazz,
-                                                    methodID,args);
+                                                     methodID,args);
     }
     jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
-                                     jmethodID methodID, const jvalue * args) {
+                                      jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualShortMethodA(this,obj,clazz,
-                                                    methodID,args);
+                                                     methodID,args);
     }
 
     jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
-                                jmethodID methodID, ...) {
+                                 jmethodID methodID, ...) {
         va_list args;
-       jint result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
-                                                    methodID,args);
-       va_end(args);
-       return result;
+        jint result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
+                                                     methodID,args);
+        va_end(args);
+        return result;
     }
     jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
-                                 jmethodID methodID, va_list args) {
+                                  jmethodID methodID, va_list args) {
         return functions->CallNonvirtualIntMethodV(this,obj,clazz,
-                                                  methodID,args);
+                                                   methodID,args);
     }
     jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
-                                 jmethodID methodID, const jvalue * args) {
+                                  jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualIntMethodA(this,obj,clazz,
-                                                  methodID,args);
+                                                   methodID,args);
     }
 
     jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
-                                  jmethodID methodID, ...) {
+                                   jmethodID methodID, ...) {
         va_list args;
-       jlong result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
-                                                     methodID,args);
-       va_end(args);
-       return result;
+        jlong result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
+                                                      methodID,args);
+        va_end(args);
+        return result;
     }
     jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
-                                   jmethodID methodID, va_list args) {
+                                    jmethodID methodID, va_list args) {
         return functions->CallNonvirtualLongMethodV(this,obj,clazz,
-                                                   methodID,args);
+                                                    methodID,args);
     }
     jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
-                                   jmethodID methodID, const jvalue * args) {
+                                    jmethodID methodID, const jvalue * args) {
         return functions->CallNonvirtualLongMethodA(this,obj,clazz,
-                                                   methodID,args);
+                                                    methodID,args);
     }
 
     jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
-                                    jmethodID methodID, ...) {
+                                     jmethodID methodID, ...) {
         va_list args;
-       jfloat result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
-                                                      methodID,args);
-       va_end(args);
-       return result;
+        jfloat result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+                                                       methodID,args);
+        va_end(args);
+        return result;
     }
     jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
-                                     jmethodID methodID,
-                                     va_list args) {
+                                      jmethodID methodID,
+                                      va_list args) {
         return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
-                                                    methodID,args);
+                                                     methodID,args);
     }
     jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
-                                     jmethodID methodID,
-                                     const jvalue * args) {
+                                      jmethodID methodID,
+                                      const jvalue * args) {
         return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
-                                                    methodID,args);
+                                                     methodID,args);
     }
 
     jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
-                                      jmethodID methodID, ...) {
+                                       jmethodID methodID, ...) {
         va_list args;
-       jdouble result;
-       va_start(args,methodID);
-       result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
-                                                       methodID,args);
-       va_end(args);
-       return result;
+        jdouble result;
+        va_start(args,methodID);
+        result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+                                                        methodID,args);
+        va_end(args);
+        return result;
     }
     jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
-                                       jmethodID methodID,
-                                       va_list args) {
+                                        jmethodID methodID,
+                                        va_list args) {
         return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
-                                                     methodID,args);
+                                                      methodID,args);
     }
     jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
-                                       jmethodID methodID,
-                                       const jvalue * args) {
+                                        jmethodID methodID,
+                                        const jvalue * args) {
         return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
-                                                     methodID,args);
+                                                      methodID,args);
     }
 
     void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
-                                 jmethodID methodID, ...) {
+                                  jmethodID methodID, ...) {
         va_list args;
-       va_start(args,methodID);
-       functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
-       va_end(args);
+        va_start(args,methodID);
+        functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+        va_end(args);
     }
     void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
-                                  jmethodID methodID,
-                                  va_list args) {
+                                   jmethodID methodID,
+                                   va_list args) {
         functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
     }
     void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
-                                  jmethodID methodID,
-                                  const jvalue * args) {
+                                   jmethodID methodID,
+                                   const jvalue * args) {
         functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
     }
 
     jfieldID GetFieldID(jclass clazz, const char *name,
-                       const char *sig) {
+                        const char *sig) {
         return functions->GetFieldID(this,clazz,name,sig);
     }
 
@@ -1293,222 +1311,222 @@ struct JNIEnv_ {
         functions->SetObjectField(this,obj,fieldID,val);
     }
     void SetBooleanField(jobject obj, jfieldID fieldID,
-                        jboolean val) {
+                         jboolean val) {
         functions->SetBooleanField(this,obj,fieldID,val);
     }
     void SetByteField(jobject obj, jfieldID fieldID,
-                     jbyte val) {
+                      jbyte val) {
         functions->SetByteField(this,obj,fieldID,val);
     }
     void SetCharField(jobject obj, jfieldID fieldID,
-                     jchar val) {
+                      jchar val) {
         functions->SetCharField(this,obj,fieldID,val);
     }
     void SetShortField(jobject obj, jfieldID fieldID,
-                      jshort val) {
+                       jshort val) {
         functions->SetShortField(this,obj,fieldID,val);
     }
     void SetIntField(jobject obj, jfieldID fieldID,
-                    jint val) {
+                     jint val) {
         functions->SetIntField(this,obj,fieldID,val);
     }
     void SetLongField(jobject obj, jfieldID fieldID,
-                     jlong val) {
+                      jlong val) {
         functions->SetLongField(this,obj,fieldID,val);
     }
     void SetFloatField(jobject obj, jfieldID fieldID,
-                      jfloat val) {
+                       jfloat val) {
         functions->SetFloatField(this,obj,fieldID,val);
     }
     void SetDoubleField(jobject obj, jfieldID fieldID,
-                       jdouble val) {
+                        jdouble val) {
         functions->SetDoubleField(this,obj,fieldID,val);
     }
 
     jmethodID GetStaticMethodID(jclass clazz, const char *name,
-                               const char *sig) {
+                                const char *sig) {
         return functions->GetStaticMethodID(this,clazz,name,sig);
     }
 
     jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
-                            ...) {
+                             ...) {
         va_list args;
-       jobject result;
-       va_start(args,methodID);
-       result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jobject result;
+        va_start(args,methodID);
+        result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
-                             va_list args) {
+                              va_list args) {
         return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
     }
     jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
-                             const jvalue *args) {
+                              const jvalue *args) {
         return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
     }
 
     jboolean CallStaticBooleanMethod(jclass clazz,
-                                    jmethodID methodID, ...) {
+                                     jmethodID methodID, ...) {
         va_list args;
-       jboolean result;
-       va_start(args,methodID);
-       result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jboolean result;
+        va_start(args,methodID);
+        result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jboolean CallStaticBooleanMethodV(jclass clazz,
-                                     jmethodID methodID, va_list args) {
+                                      jmethodID methodID, va_list args) {
         return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
     }
     jboolean CallStaticBooleanMethodA(jclass clazz,
-                                     jmethodID methodID, const jvalue *args) {
+                                      jmethodID methodID, const jvalue *args) {
         return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
     }
 
     jbyte CallStaticByteMethod(jclass clazz,
-                              jmethodID methodID, ...) {
+                               jmethodID methodID, ...) {
         va_list args;
-       jbyte result;
-       va_start(args,methodID);
-       result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jbyte result;
+        va_start(args,methodID);
+        result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jbyte CallStaticByteMethodV(jclass clazz,
-                               jmethodID methodID, va_list args) {
+                                jmethodID methodID, va_list args) {
         return functions->CallStaticByteMethodV(this,clazz,methodID,args);
     }
     jbyte CallStaticByteMethodA(jclass clazz,
-                               jmethodID methodID, const jvalue *args) {
+                                jmethodID methodID, const jvalue *args) {
         return functions->CallStaticByteMethodA(this,clazz,methodID,args);
     }
 
     jchar CallStaticCharMethod(jclass clazz,
-                              jmethodID methodID, ...) {
+                               jmethodID methodID, ...) {
         va_list args;
-       jchar result;
-       va_start(args,methodID);
-       result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jchar result;
+        va_start(args,methodID);
+        result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jchar CallStaticCharMethodV(jclass clazz,
-                               jmethodID methodID, va_list args) {
+                                jmethodID methodID, va_list args) {
         return functions->CallStaticCharMethodV(this,clazz,methodID,args);
     }
     jchar CallStaticCharMethodA(jclass clazz,
-                               jmethodID methodID, const jvalue *args) {
+                                jmethodID methodID, const jvalue *args) {
         return functions->CallStaticCharMethodA(this,clazz,methodID,args);
     }
 
     jshort CallStaticShortMethod(jclass clazz,
-                                jmethodID methodID, ...) {
+                                 jmethodID methodID, ...) {
         va_list args;
-       jshort result;
-       va_start(args,methodID);
-       result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jshort result;
+        va_start(args,methodID);
+        result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jshort CallStaticShortMethodV(jclass clazz,
-                                 jmethodID methodID, va_list args) {
+                                  jmethodID methodID, va_list args) {
         return functions->CallStaticShortMethodV(this,clazz,methodID,args);
     }
     jshort CallStaticShortMethodA(jclass clazz,
-                                 jmethodID methodID, const jvalue *args) {
+                                  jmethodID methodID, const jvalue *args) {
         return functions->CallStaticShortMethodA(this,clazz,methodID,args);
     }
 
     jint CallStaticIntMethod(jclass clazz,
-                            jmethodID methodID, ...) {
+                             jmethodID methodID, ...) {
         va_list args;
-       jint result;
-       va_start(args,methodID);
-       result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jint result;
+        va_start(args,methodID);
+        result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jint CallStaticIntMethodV(jclass clazz,
-                             jmethodID methodID, va_list args) {
+                              jmethodID methodID, va_list args) {
         return functions->CallStaticIntMethodV(this,clazz,methodID,args);
     }
     jint CallStaticIntMethodA(jclass clazz,
-                             jmethodID methodID, const jvalue *args) {
+                              jmethodID methodID, const jvalue *args) {
         return functions->CallStaticIntMethodA(this,clazz,methodID,args);
     }
 
     jlong CallStaticLongMethod(jclass clazz,
-                              jmethodID methodID, ...) {
+                               jmethodID methodID, ...) {
         va_list args;
-       jlong result;
-       va_start(args,methodID);
-       result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jlong result;
+        va_start(args,methodID);
+        result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jlong CallStaticLongMethodV(jclass clazz,
-                               jmethodID methodID, va_list args) {
+                                jmethodID methodID, va_list args) {
         return functions->CallStaticLongMethodV(this,clazz,methodID,args);
     }
     jlong CallStaticLongMethodA(jclass clazz,
-                               jmethodID methodID, const jvalue *args) {
+                                jmethodID methodID, const jvalue *args) {
         return functions->CallStaticLongMethodA(this,clazz,methodID,args);
     }
 
     jfloat CallStaticFloatMethod(jclass clazz,
-                                jmethodID methodID, ...) {
+                                 jmethodID methodID, ...) {
         va_list args;
-       jfloat result;
-       va_start(args,methodID);
-       result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jfloat result;
+        va_start(args,methodID);
+        result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jfloat CallStaticFloatMethodV(jclass clazz,
-                                 jmethodID methodID, va_list args) {
+                                  jmethodID methodID, va_list args) {
         return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
     }
     jfloat CallStaticFloatMethodA(jclass clazz,
-                                 jmethodID methodID, const jvalue *args) {
+                                  jmethodID methodID, const jvalue *args) {
         return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
     }
 
     jdouble CallStaticDoubleMethod(jclass clazz,
-                                  jmethodID methodID, ...) {
+                                   jmethodID methodID, ...) {
         va_list args;
-       jdouble result;
-       va_start(args,methodID);
-       result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
-       va_end(args);
-       return result;
+        jdouble result;
+        va_start(args,methodID);
+        result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+        va_end(args);
+        return result;
     }
     jdouble CallStaticDoubleMethodV(jclass clazz,
-                                   jmethodID methodID, va_list args) {
+                                    jmethodID methodID, va_list args) {
         return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
     }
     jdouble CallStaticDoubleMethodA(jclass clazz,
-                                   jmethodID methodID, const jvalue *args) {
+                                    jmethodID methodID, const jvalue *args) {
         return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
     }
 
     void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
         va_list args;
-       va_start(args,methodID);
-       functions->CallStaticVoidMethodV(this,cls,methodID,args);
-       va_end(args);
+        va_start(args,methodID);
+        functions->CallStaticVoidMethodV(this,cls,methodID,args);
+        va_end(args);
     }
     void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
-                              va_list args) {
+                               va_list args) {
         functions->CallStaticVoidMethodV(this,cls,methodID,args);
     }
     void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
-                              const jvalue * args) {
+                               const jvalue * args) {
         functions->CallStaticVoidMethodA(this,cls,methodID,args);
     }
 
     jfieldID GetStaticFieldID(jclass clazz, const char *name,
-                             const char *sig) {
+                              const char *sig) {
         return functions->GetStaticFieldID(this,clazz,name,sig);
     }
     jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
@@ -1540,39 +1558,39 @@ struct JNIEnv_ {
     }
 
     void SetStaticObjectField(jclass clazz, jfieldID fieldID,
-                       jobject value) {
+                        jobject value) {
       functions->SetStaticObjectField(this,clazz,fieldID,value);
     }
     void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
-                       jboolean value) {
+                        jboolean value) {
       functions->SetStaticBooleanField(this,clazz,fieldID,value);
     }
     void SetStaticByteField(jclass clazz, jfieldID fieldID,
-                       jbyte value) {
+                        jbyte value) {
       functions->SetStaticByteField(this,clazz,fieldID,value);
     }
     void SetStaticCharField(jclass clazz, jfieldID fieldID,
-                       jchar value) {
+                        jchar value) {
       functions->SetStaticCharField(this,clazz,fieldID,value);
     }
     void SetStaticShortField(jclass clazz, jfieldID fieldID,
-                       jshort value) {
+                        jshort value) {
       functions->SetStaticShortField(this,clazz,fieldID,value);
     }
     void SetStaticIntField(jclass clazz, jfieldID fieldID,
-                       jint value) {
+                        jint value) {
       functions->SetStaticIntField(this,clazz,fieldID,value);
     }
     void SetStaticLongField(jclass clazz, jfieldID fieldID,
-                       jlong value) {
+                        jlong value) {
       functions->SetStaticLongField(this,clazz,fieldID,value);
     }
     void SetStaticFloatField(jclass clazz, jfieldID fieldID,
-                       jfloat value) {
+                        jfloat value) {
       functions->SetStaticFloatField(this,clazz,fieldID,value);
     }
     void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
-                       jdouble value) {
+                        jdouble value) {
       functions->SetStaticDoubleField(this,clazz,fieldID,value);
     }
 
@@ -1607,14 +1625,14 @@ struct JNIEnv_ {
     }
 
     jobjectArray NewObjectArray(jsize len, jclass clazz,
-                               jobject init) {
+                                jobject init) {
         return functions->NewObjectArray(this,len,clazz,init);
     }
     jobject GetObjectArrayElement(jobjectArray array, jsize index) {
         return functions->GetObjectArrayElement(this,array,index);
     }
     void SetObjectArrayElement(jobjectArray array, jsize index,
-                              jobject val) {
+                               jobject val) {
         functions->SetObjectArrayElement(this,array,index,val);
     }
 
@@ -1669,114 +1687,114 @@ struct JNIEnv_ {
     }
 
     void ReleaseBooleanArrayElements(jbooleanArray array,
-                                    jboolean *elems,
-                                    jint mode) {
+                                     jboolean *elems,
+                                     jint mode) {
         functions->ReleaseBooleanArrayElements(this,array,elems,mode);
     }
     void ReleaseByteArrayElements(jbyteArray array,
-                                 jbyte *elems,
-                                 jint mode) {
+                                  jbyte *elems,
+                                  jint mode) {
         functions->ReleaseByteArrayElements(this,array,elems,mode);
     }
     void ReleaseCharArrayElements(jcharArray array,
-                                 jchar *elems,
-                                 jint mode) {
+                                  jchar *elems,
+                                  jint mode) {
         functions->ReleaseCharArrayElements(this,array,elems,mode);
     }
     void ReleaseShortArrayElements(jshortArray array,
-                                  jshort *elems,
-                                  jint mode) {
+                                   jshort *elems,
+                                   jint mode) {
         functions->ReleaseShortArrayElements(this,array,elems,mode);
     }
     void ReleaseIntArrayElements(jintArray array,
-                                jint *elems,
-                                jint mode) {
+                                 jint *elems,
+                                 jint mode) {
         functions->ReleaseIntArrayElements(this,array,elems,mode);
     }
     void ReleaseLongArrayElements(jlongArray array,
-                                 jlong *elems,
-                                 jint mode) {
+                                  jlong *elems,
+                                  jint mode) {
         functions->ReleaseLongArrayElements(this,array,elems,mode);
     }
     void ReleaseFloatArrayElements(jfloatArray array,
-                                  jfloat *elems,
-                                  jint mode) {
+                                   jfloat *elems,
+                                   jint mode) {
         functions->ReleaseFloatArrayElements(this,array,elems,mode);
     }
     void ReleaseDoubleArrayElements(jdoubleArray array,
-                                   jdouble *elems,
-                                   jint mode) {
+                                    jdouble *elems,
+                                    jint mode) {
         functions->ReleaseDoubleArrayElements(this,array,elems,mode);
     }
 
     void GetBooleanArrayRegion(jbooleanArray array,
-                              jsize start, jsize len, jboolean *buf) {
+                               jsize start, jsize len, jboolean *buf) {
         functions->GetBooleanArrayRegion(this,array,start,len,buf);
     }
     void GetByteArrayRegion(jbyteArray array,
-                           jsize start, jsize len, jbyte *buf) {
+                            jsize start, jsize len, jbyte *buf) {
         functions->GetByteArrayRegion(this,array,start,len,buf);
     }
     void GetCharArrayRegion(jcharArray array,
-                           jsize start, jsize len, jchar *buf) {
+                            jsize start, jsize len, jchar *buf) {
         functions->GetCharArrayRegion(this,array,start,len,buf);
     }
     void GetShortArrayRegion(jshortArray array,
-                            jsize start, jsize len, jshort *buf) {
+                             jsize start, jsize len, jshort *buf) {
         functions->GetShortArrayRegion(this,array,start,len,buf);
     }
     void GetIntArrayRegion(jintArray array,
-                          jsize start, jsize len, jint *buf) {
+                           jsize start, jsize len, jint *buf) {
         functions->GetIntArrayRegion(this,array,start,len,buf);
     }
     void GetLongArrayRegion(jlongArray array,
-                           jsize start, jsize len, jlong *buf) {
+                            jsize start, jsize len, jlong *buf) {
         functions->GetLongArrayRegion(this,array,start,len,buf);
     }
     void GetFloatArrayRegion(jfloatArray array,
-                            jsize start, jsize len, jfloat *buf) {
+                             jsize start, jsize len, jfloat *buf) {
         functions->GetFloatArrayRegion(this,array,start,len,buf);
     }
     void GetDoubleArrayRegion(jdoubleArray array,
-                             jsize start, jsize len, jdouble *buf) {
+                              jsize start, jsize len, jdouble *buf) {
         functions->GetDoubleArrayRegion(this,array,start,len,buf);
     }
 
     void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
-                              const jboolean *buf) {
+                               const jboolean *buf) {
         functions->SetBooleanArrayRegion(this,array,start,len,buf);
     }
     void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
-                           const jbyte *buf) {
+                            const jbyte *buf) {
         functions->SetByteArrayRegion(this,array,start,len,buf);
     }
     void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
-                           const jchar *buf) {
+                            const jchar *buf) {
         functions->SetCharArrayRegion(this,array,start,len,buf);
     }
     void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
-                            const jshort *buf) {
+                             const jshort *buf) {
         functions->SetShortArrayRegion(this,array,start,len,buf);
     }
     void SetIntArrayRegion(jintArray array, jsize start, jsize len,
-                          const jint *buf) {
+                           const jint *buf) {
         functions->SetIntArrayRegion(this,array,start,len,buf);
     }
     void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
-                           const jlong *buf) {
+                            const jlong *buf) {
         functions->SetLongArrayRegion(this,array,start,len,buf);
     }
     void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
-                            const jfloat *buf) {
+                             const jfloat *buf) {
         functions->SetFloatArrayRegion(this,array,start,len,buf);
     }
     void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
-                             const jdouble *buf) {
+                              const jdouble *buf) {
         functions->SetDoubleArrayRegion(this,array,start,len,buf);
     }
 
     jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
-                        jint nMethods) {
+                         jint nMethods) {
         return functions->RegisterNatives(this,clazz,methods,nMethods);
     }
     jint UnregisterNatives(jclass clazz) {
@@ -1823,7 +1841,7 @@ struct JNIEnv_ {
     }
 
     jboolean ExceptionCheck() {
-       return functions->ExceptionCheck(this);
+        return functions->ExceptionCheck(this);
     }
 
     jobject NewDirectByteBuffer(void* address, jlong capacity) {
@@ -1933,12 +1951,10 @@ JNI_OnUnload(JavaVM *vm, void *reserved);
 #define JNI_VERSION_1_2 0x00010002
 #define JNI_VERSION_1_4 0x00010004
 #define JNI_VERSION_1_6 0x00010006
+#define JNI_VERSION_1_8 0x00010008
 
 #ifdef __cplusplus
 } /* extern "C" */
 #endif /* __cplusplus */
 
 #endif /* !_JAVASOFT_JNI_H_ */
-
-
-
diff --git a/org.simantics.fmil.core/native/FMUSimulator/include/linux/jni_md.h b/org.simantics.fmil.core/native/FMUSimulator/include/linux/jni_md.h
new file mode 100644 (file)
index 0000000..ff30a32
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+
+#ifndef _JAVASOFT_JNI_MD_H_
+#define _JAVASOFT_JNI_MD_H_
+
+#ifndef __has_attribute
+  #define __has_attribute(x) 0
+#endif
+#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
+  #define JNIEXPORT     __attribute__((visibility("default")))
+  #define JNIIMPORT     __attribute__((visibility("default")))
+#else
+  #define JNIEXPORT
+  #define JNIIMPORT
+#endif
+
+#define JNICALL
+
+typedef int jint;
+#ifdef _LP64 /* 64-bit Solaris */
+typedef long jlong;
+#else
+typedef long long jlong;
+#endif
+
+typedef signed char jbyte;
+
+#endif /* !_JAVASOFT_JNI_MD_H_ */
index a2a5180a5cfdd5c13cf0d7ad1637498f32ef556e..53359aae6557f7ad57fa7745126d6b79fa2d0be7 100644 (file)
 #define SEVEN_ZIP_OUT_OF_MEMORY 8\r
 #define SEVEN_ZIP_STOPPED_BY_USER 255\r
 \r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
 void fmuLogger(fmiComponent c, fmiString instanceName, fmiStatus status, fmiString category, fmiString message, ...);\r
 int unzip(const char *zipPath, const char *outPath);\r
 void parseArguments(int argc, char *argv[], char** fmuFileName, double* tEnd, double* h, int* loggingOn, char* csv_separator);\r
 int loadFMU(FMU *fmu, const char* fmuFileName, const char* tmpPath);\r
-void outputRow(FMU *fmu, fmiComponent c, double time, FILE* file, char separator, boolean header);\r
+void outputRow(FMU *fmu, fmiComponent c, double time, FILE* file, char separator, unsigned char header);\r
 int error(const char* message);\r
 void printHelp(const char* fmusim);\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
index 80c66ce57495134b3ad88665250ccf550ca79557..285be84e42627582224722227a789c39fd9436a5 100644 (file)
@@ -31,9 +31,6 @@ extern "C" {
 
 #define PRINT(fmt,args) { FILE *fp = fopen("R:\\Simantics\\Sysdyn\\log.txt", "ab"); fprintf(fp, fmt, args); fclose(fp); }
 
-#include <direct.h>
-#define GetCurrentDir _getcwd
-
 using namespace std;
 
 struct FMI1 {
@@ -142,7 +139,6 @@ bool exists(string id) {
 JNIEXPORT jint JNICALL Java_org_simantics_fmil_core_FMIL_loadFMUFile_1 
        (JNIEnv *env, jobject obj, jstring path, jstring tempDir) {
 
-       HMODULE module = NULL;
        FMI1 fmi1;
        FMIL_Variable *vars;
        FMIL_DeclaredType *types;
@@ -455,7 +451,6 @@ JNIEXPORT jdoubleArray JNICALL Java_org_simantics_fmil_core_FMIL_getSubscribedRe
        jsize n = env -> GetArrayLength(result);
        int *vrs;
        const char *error = "";
-       int returnValue = 0;
 
        FMI1 fmi = fmus[id];
        if(n > 0) {
@@ -525,7 +520,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllVariables
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));  
    
-       for(int i=0;i<fmus[id].variables.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].variables.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].variables[i].c_str()));  
        }  
 
@@ -540,7 +535,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllVariableD
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));  
    
-       for(int i=0;i<fmus[id].descriptions.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].descriptions.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].descriptions[i].c_str()));  
        }  
 
@@ -555,7 +550,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllVariableD
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));
    
-       for(int i=0;i<fmus[id].declaredTypes.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].declaredTypes.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].declaredTypes[i].c_str()));  
        }  
 
@@ -610,8 +605,7 @@ JNIEXPORT jintArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllVariableVari
        jint* resultElements = env -> GetIntArrayElements(result, &isCopy);
        jsize n = env -> GetArrayLength(result);
 
-       int i;
-       for (i = 0; i < n; i++) {
+       for (jsize i = 0; i < n; i++) {
                resultElements[i] = fmus[id].variabilities[i];
        } 
          
@@ -630,8 +624,7 @@ JNIEXPORT jintArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllVariableCaus
        jint* resultElements = env -> GetIntArrayElements(result, &isCopy);
        jsize n = env -> GetArrayLength(result);
 
-       int i;
-       for (i = 0; i < n; i++) {
+       for (jsize i = 0; i < n; i++) {
                resultElements[i] = fmus[id].causalities[i];
        } 
          
@@ -650,7 +643,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllDeclaredT
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));
    
-       for(int i=0;i<fmus[id].declaredTypeNames.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].declaredTypeNames.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].declaredTypeNames[i].c_str()));  
        }  
 
@@ -665,7 +658,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllDeclaredT
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));
    
-       for(int i=0;i<fmus[id].typeDescriptions.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].typeDescriptions.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].typeDescriptions[i].c_str()));  
        }  
 
@@ -680,7 +673,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllDeclaredT
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));
    
-       for(int i=0;i<fmus[id].quantities.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].quantities.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].quantities[i].c_str()));  
        }  
 
@@ -695,7 +688,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_fmil_core_FMIL_getAllDeclaredT
                        env->FindClass("java/lang/String"),  
                        env->NewStringUTF(""));
    
-       for(int i=0;i<fmus[id].units.size();i++) {  
+       for(unsigned int i=0;i<fmus[id].units.size();i++) {  
                env->SetObjectArrayElement(ret,i,env->NewStringUTF(fmus[id].units[i].c_str()));  
        }  
 
@@ -981,4 +974,4 @@ JNIEXPORT jstring JNICALL Java_org_simantics_fmil_core_FMIL_getStringValue_1
        */
          return 0;
 
-}
\ No newline at end of file
+}
index 5f2cb62170d8aaed5409531bd9b650ed8b19b29f..71915f02785ee474d3226183615fcf627f7d7bb9 100644 (file)
@@ -11,6 +11,7 @@
 #include <string.h>\r
 #include <assert.h>\r
 #include <time.h>\r
+#include <stdarg.h>\r
 \r
 #ifdef FMI_COSIMULATION\r
 #include "fmi_cs.h"\r
 #include "fmi_me.h"\r
 #endif\r
 \r
+// linux/unix DSO loading\r
+#ifndef _MSC_VER\r
+#include <dlfcn.h>\r
+#endif\r
+\r
 #include "sim_support.h"\r
 //#include "fmuExtract.h"\r
 \r
+#define MAX_PATH_SIZE 4096\r
+\r
+#ifdef _MSC_VER\r
 // fileName is an absolute path, e.g. C:\test\a.fmu\r
 // or relative to the current dir, e.g. ..\test\a.fmu\r
 // Does not check for existence of the file\r
 static char* getFmuPath(const char* fileName){\r
-    char pathName[MAX_PATH];\r
+    char pathName[MAX_PATH_SIZE];\r
     int n = GetFullPathName(fileName, MAX_PATH, pathName, NULL);\r
     return n ? strdup(pathName) : NULL;\r
 }\r
@@ -49,12 +58,17 @@ static char* getTmpPath() {
 \r
     return strdup(tmpPath);\r
 }\r
+#endif\r
 \r
 static void* getAdr(int* s, FMU *fmu, const char* functionName){\r
     char name[BUFSIZE];\r
     void* fp;\r
     sprintf(name, "%s_%s", getModelIdentifier(fmu->modelDescription), functionName);\r
+#ifdef _MSC_VER\r
     fp = GetProcAddress(fmu->dllHandle, name);\r
+#else\r
+    fp = dlsym(fmu->dllHandle, name);\r
+#endif\r
     if (!fp) {\r
         printf ("warning: Function %s not found in dll\n", name);\r
         *s = 0; // mark dll load as 'failed'        \r
@@ -65,14 +79,24 @@ static void* getAdr(int* s, FMU *fmu, const char* functionName){
 // Load the given dll and set function pointers in fmu\r
 // Return 0 to indicate failure\r
 static int loadDll(const char* dllPath, FMU *fmu) {\r
-    int x = 1, s = 1;\r
+    int s = 1;\r
+#ifdef _MSC_VER\r
     HANDLE h = LoadLibraryEx(dllPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);\r
     if (!h) {\r
-               int error = GetLastError();\r
+        int error = GetLastError();\r
         printf("error %d: Could not load %s\n", error, dllPath);\r
         return 0; // failure\r
     }\r
     fmu->dllHandle = h;\r
+#else\r
+    void* h = dlopen(dllPath, RTLD_LAZY);\r
+    if (!h) {\r
+        char* error = dlerror();\r
+        printf("error %s: Could not load %s\n", error, dllPath);\r
+        return 0; // failure\r
+    }\r
+    fmu->dllHandle = h;\r
+#endif\r
 \r
 #ifdef FMI_COSIMULATION   \r
     fmu->getTypesPlatform        = (fGetTypesPlatform)   getAdr(&s, fmu, "fmiGetTypesPlatform");\r
@@ -126,7 +150,7 @@ static int loadDll(const char* dllPath, FMU *fmu) {
     return s; \r
 }\r
 \r
-static void printModelDescription(ModelDescription* md){\r
+/*static void printModelDescription(ModelDescription* md){\r
     Element* e = (Element*)md;  \r
     int i;\r
     printf("%s\n", elmNames[e->type]);\r
@@ -143,6 +167,7 @@ static void printModelDescription(ModelDescription* md){
         printf("  %s=%s\n", e->attributes[i], e->attributes[i+1]);\r
 #endif // FMI_COSIMULATION  \r
 }\r
+*/\r
 \r
 /*\r
  * return: 1 for successful laod or number for error.\r
@@ -329,7 +354,7 @@ static void replaceRefsInMessage(const char* msg, char* buffer, int nBuffer, FMU
             c = msg[i];\r
         }\r
         else {\r
-            char* end = strchr(msg+i+1, '#');\r
+            char* end = strchr(const_cast<char*>(msg+i+1), '#');\r
             if (!end) {\r
                 printf("unmatched '#' in '%s'\n", msg);\r
                 buffer[k++]='#';\r
@@ -371,12 +396,13 @@ static void replaceRefsInMessage(const char* msg, char* buffer, int nBuffer, FMU
 void fmuLogger(FMU *fmu, fmiComponent c, fmiString instanceName, fmiStatus status,\r
                fmiString category, fmiString message, ...) {\r
     char msg[MAX_MSG_SIZE];\r
-    char* copy;\r
+//    char* copy;\r
     va_list argp;\r
 \r
     // replace C format strings\r
-         va_start(argp, message);\r
+    va_start(argp, message);\r
     vsprintf(msg, message, argp);\r
+    va_end(argp);\r
 \r
     // replace e.g. ## and #r12#  \r
 //    copy = strdup(msg);\r
index 3a7c031dc2522a60d8d1ff2e2028947a0e16cb8b..fa09a71c4e2536af375ba8b4b0c65cf6a6839b89 100644 (file)
@@ -61,7 +61,7 @@ public class FMIL {
                 simulatorFMIUrl = FileLocator.find(b, new Path("libraries/FMUSimulator.dll"), null);
             } else if(env.os == OSType.LINUX) {
                 sharedFMILIBUrl = FileLocator.find(b, new Path("libraries/libfmilib_shared.so"), null);
-                simulatorFMIUrl = FileLocator.find(b, new Path("libraries/FMUSimulator.so"), null);
+                simulatorFMIUrl = FileLocator.find(b, new Path("libraries/libFMUSimulator.so"), null);
             }
 
             libraries[0] = new File(FileLocator.toFileURL(sharedFMILIBUrl).getPath());
@@ -206,8 +206,8 @@ public class FMIL {
 
             try {
                 String tmpPath = tempDir.getAbsolutePath();
-                if(!tmpPath.endsWith("\\"))
-                    tmpPath = tmpPath + "\\";
+                if(!tmpPath.endsWith("\\") && !tmpPath.endsWith("/"))
+                    tmpPath = tmpPath + "/";
                 id = loadFMUFile_(path, tmpPath);
                 
                 getAllVariables();
@@ -221,6 +221,7 @@ public class FMIL {
             } catch (UnsatisfiedLinkError err) {
                 throw new FMILException(UNSATISFIED_LINK, err);
             } catch (Exception e) {
+               LOGGER.error(e.getMessage());
                 throw new FMILException(e.getMessage());
             }
         }
diff --git a/org.simantics.fmil.linux64/DockerFile/Dockerfile b/org.simantics.fmil.linux64/DockerFile/Dockerfile
deleted file mode 100644 (file)
index e6f68b5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-FROM ubuntu:16.04
-
-MAINTAINER miro.eklund@semantum.fi
-
-ARG fmi='http://www.jmodelica.org/downloads/FMIL/FMILibrary-2.0.3-src.zip'
-
-RUN apt-get update && \
-       apt-get -y upgrade
-
-RUN apt-get install -y wget cmake unzip build-essential
-
-RUN mkdir /builds && \
-       mkdir /builds/fmilsrc && \
-       mkdir /builds/fmil && \
-       mkdir /builds/fmildebug
-
-RUN wget -O /builds/fmilsrc/fmil.zip $fmi
-
-WORKDIR /builds/fmilsrc
-
-RUN unzip /builds/fmilsrc/fmil.zip && \
-       rm /builds/fmilsrc/fmil.zip
-
-WORKDIR /builds/fmil
-
-RUN cmake /builds/fmilsrc/FMILibrary-2.0.3
-
-RUN make
-RUN make install test >> /fmil.log
-
-WORKDIR /builds/fmildebug
-
-RUN cmake -DFMILIB_ENABLE_LOG_LEVEL_DEBUG=ON /builds/fmilsrc/FMILibrary-2.0.3
-
-RUN make
-RUN make install test >> /fmildebug.log
-
-COPY ./copytovolume.sh /copytovolume.sh
-RUN chmod 755 /copytovolume.sh
-ENTRYPOINT /copytovolume.sh
diff --git a/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so b/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so
new file mode 100755 (executable)
index 0000000..fb8380e
Binary files /dev/null and b/org.simantics.fmil.linux64/libraries/debug/libFMUSimulator.so differ
old mode 100644 (file)
new mode 100755 (executable)
index 572b3fb..4b491a0
Binary files a/org.simantics.fmil.linux64/libraries/debug/libfmilib_shared.so and b/org.simantics.fmil.linux64/libraries/debug/libfmilib_shared.so differ
diff --git a/org.simantics.fmil.linux64/libraries/libFMUSimulator.so b/org.simantics.fmil.linux64/libraries/libFMUSimulator.so
new file mode 100755 (executable)
index 0000000..906a438
Binary files /dev/null and b/org.simantics.fmil.linux64/libraries/libFMUSimulator.so differ
old mode 100644 (file)
new mode 100755 (executable)
index 6e5d495..a4b089d
Binary files a/org.simantics.fmil.linux64/libraries/libfmilib_shared.so and b/org.simantics.fmil.linux64/libraries/libfmilib_shared.so differ