Skip to content

add wrapper functions to make GBL C++ accessible to java via JNA

I've gotten this working but I have a few more tasks I wish to accomplish before merging.

  • Update HPS's use to better handle the JNA library
  • Test for memory leaking via JNA
  • Update documentation with how to use JNA Wrappers

Closes #1 (closed)

What I've done are the two main tasks described in #1 (closed) :

  1. I wrote wrapper functions in a extern "C" block so that their names are not mangled and they can be accessible via java's FFI.
  2. I slightly updated the initialization of GblPoint to ensure that matrices have a reasonable default value in their elements.

Besides these two planned updates, I made some other changes.

  1. I added a CMake option JNA_DEBUG that, if enabled by the user, turns on a compiler definition of the same name so that the wrapper functions know if they should be counting objects and printing out debug statements for the user running them from java.
  2. I removed the executable permissions on various C++ source files. I do not see why they should have executable permissions.
  3. I added doxygen comments to the wrapper functions that include defining a new "page" in the documentation called "JNA Usage". This page is where extra information about how to use these wrappers from within java is stored.
  4. I added another CMake option JNA_MEMORY_MONITOR that, if enabled by the user, tells the JNA wrapper functions to keep running counts of all the structures that are currently allocated in memory. It also defines a function that runs when the program is done executing (and the GBL library is being offloaded) that prints these tallies so the developer of a JNA-GBL program can make sure that they are cleaning up all the memory allocated on the GBL side.
Edited by Thomas Eichlersmith

Merge request reports