From 5228df9a8bf53411e6786d11df967217d4c47247 Mon Sep 17 00:00:00 2001 From: Nicolas Oliver Date: Mon, 2 Oct 2017 13:22:46 -0700 Subject: [PATCH] docs: remove empty lines in create_java_bindings Signed-off-by: Nicolas Oliver --- docs/creating_java_bindings.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/creating_java_bindings.md b/docs/creating_java_bindings.md index f77b87a9..675c8394 100644 --- a/docs/creating_java_bindings.md +++ b/docs/creating_java_bindings.md @@ -67,7 +67,6 @@ As much as possible, avoid passing values/returning values through pointers give ``` 3. Functions that return N values through pointers, that do not make sense to grouped together (e.g. a general purpose function that returns both the light intensity and air pollution), should be __replaced by__ N functions (one for each value) that read only one specific value. E.g.: - ```c++ /* * Function returns the light intensity and air pollution @@ -82,7 +81,6 @@ As much as possible, avoid passing values/returning values through pointers give ``` 4. Functions that return N values through pointers; values that do not make sense to be grouped together, but are time dependent, and make sense to be read at the same time. For example, a sensor that reads air humidity and temperature. A user may want to know the temperature value _temp_ read at the exact moment the humidity value _humid_ was read. These should be __replaced by__ N+1 functions: a _getData()_ function that reads all values at the same time and stores them in global variables; and N getter functions, one for each value. E.g. - ```c++ /* * Function returns the light intensity and air pollution @@ -325,18 +323,16 @@ Consider the following files: The build process of a java module using SWIG is split into two steps: 1. Generating the intermediate files, from the SWIG interface file. This will produce the java class file (Example.java), the JNI file (exampleJNI.java) and wrapper file (example_wrap.cxx). The source file (example.cxx) is not needed in the first step. - ``` -swig -c++ -java example.i + swig -c++ -java example.i ``` 2. Generating the shared library from the C++ sources and wrapper file ``` -g++ -fPIC -c example.cxx example_wrap.cxx -I/usr/lib/jvm/java-1.8.0/include -I/usr/lib/jvm/java-1.8.0/include/linux -g++ -shared example_wrap.o sensor.o -o libexample.so + g++ -fPIC -c example.cxx example_wrap.cxx -I/usr/lib/jvm/java-1.8.0/include -I/usr/lib/jvm/java-1.8.0/include/linux + g++ -shared example_wrap.o sensor.o -o libexample.so ``` - SWIGJAVA is always defined when SWIG parses the interface file, meaning it will be defined when it parses the header file (example.h) that is included in the interface file (example.i). SWIG also adds the "#define SWIGJAVA" directive in the wrapper file (example_wrap.cxx). However, in generating the shared library the SWIGJAVA symbol is only defined in the example_wrap.cxx file, because of the added "#define SWIGJAVA" directive. But we have also used the "#if defined(SWIGJAVA)" check in the source file (example.cxx), and thus need to define SWIGJAVA for it too. If we define the SWIGJAVA symbol as a compile flag, when compiling the source code to object code, the SWIGJAVA compile flag and #define SWIGJAVA" directive will clash and give a double definition warning (only a warning).