libdgmpp icon indicating copy to clipboard operation
libdgmpp copied to clipboard

A way to create modules without adding to ship

Open BlockCat opened this issue 7 years ago • 1 comments

Hello,

I was wondering if it was possible to add something to the Java-wrapper to create a module from a ship without adding it.

BlockCat avatar Feb 26 '18 22:02 BlockCat

I am not a Cxx expert but this might work (I didn't try it, just typing)

  • Add the following to Ship.hpp
Module*  createModule(TypeID typeID) { LOCK(this); return Module::Create(typeID).get(); }
  • Add a corresponding method in Ship.i

  • Run swig/build.sh

Now when I say "this might work", I am wondering about the consequences of creating modules on the fly and not destroying the underlying Module pointer when done with it on the Java side.

I am not sure if JNI takes care of deleting references that are created by it and no longer used (GCed)

evanova avatar Feb 27 '18 12:02 evanova