File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1293,14 +1293,31 @@ public void initialise() throws PrismException
12931293 }
12941294 mainLog .print ("Memory limits: cudd=" + getCUDDMaxMem ());
12951295 mainLog .println (", java(heap)=" + PrismUtils .convertBytesToMemoryString (Runtime .getRuntime ().maxMemory ()));
1296+ }
12961297
1297- // Add/initialise components/libraries
1298- libraries .add (new JDDLibrary ());
1299- libraries .add (new PrismNativeLibrary ());
1300- for (PrismLibrary lib : libraries ) {
1301- lib .initialise (this );
1298+ /**
1299+ * Ensure that the native libraries are loaded and initialised,
1300+ * and that any relevant settings are passed to them.
1301+ */
1302+ public void useNative () throws PrismException
1303+ {
1304+ // Add/initialise libraries for native code, if not already done
1305+ if (libraries .stream ().noneMatch (JDDLibrary .class ::isInstance )) {
1306+ addLibrary (new JDDLibrary ());
1307+ }
1308+ if (libraries .stream ().noneMatch (PrismNativeLibrary .class ::isInstance )) {
1309+ addLibrary (new PrismNativeLibrary ());
13021310 }
1303- setMainLog (mainLog );
1311+ }
1312+
1313+ /**
1314+ * Initialise a freshy created {@link PrismLibrary} and add to the list of libraries.
1315+ */
1316+ private void addLibrary (PrismLibrary lib ) throws PrismException
1317+ {
1318+ lib .initialise (this );
1319+ lib .setMainLog (mainLog );
1320+ libraries .add (lib );
13041321 }
13051322
13061323 /**
Original file line number Diff line number Diff line change @@ -38,5 +38,7 @@ public PrismNativeComponent(Prism prism) throws PrismException
3838 {
3939 super (prism );
4040 this .prism = prism ;
41+ // Make sure PRISM is set up to use native code.
42+ prism .useNative ();
4143 }
4244}
You can’t perform that action at this time.
0 commit comments