AMAPstudio

User Tools


Trying to connect Capsis/Java and the Phreeqc dll with JNA under Windows 64 bits

fc-13.8.2015

Context

Heterofor project (Mathieu Jonard). Mathieu would like to link to the Phreeqc dll to add soil features in Heterofor. Colleagues (José Genon) from UCL (University of Louvain la Neuve) did something close in 2014 : they connected the ANAFORE Fortran simulator (University of Anvers) to the Phreeqc dll.

Results

Tried to download material from the Phreeqc web site: we are interested in the iphreeqc dll distribution.

  • Would like to use the JNA technology already used successfully in Capsis (Organon, phelib)
  • Found a lot of things needing to be recompiled (we want something that can be used directly)
  • Found COM things, not compatible with JNA

Phreeqc distribution used for ANAFORE

  • Explored the package sent by José Genon, used for ANAFORE, containing dlls
  • contains a IPhreeqc.dll, version 3
  • DependencyWalker finds errors in the dll, including a mix of 32 and 64 bits components

Problems : several errors reported in the dll (in red), and a mix of 32/64 its components is reported. Positive : the expected function names seem to be all there.

Wrote a test library in Capsis : capsis.lib.phreeqc

  • Added a class IPhreeqc.java
  • Link to the IPhreeqc.dll based on JNA

Command to launch the test:

D:\coligny\workspace\capsis4>java -cp class;ext\*;ext\windows64 -Djna.library.pa
xt\windows64 -Djna.library.path="ext\windows64" capsis.lib.phreeqc.IPhreeqc

→ Repeated problems at launch time, UnsatisfiedLinkError

Under a JDK 1.7 64 bits:

→ “%1 n'est pas une application Win32 valide”

(And for information, under a JDK 1.7 32 bits:

→ “L'application n'a pas pu démarrer car sa configuration côte à côte est incorrecte…”)

To load the iphreeqc.dll with Java 64 bits, the key points seem to be:

  • the dll seems to mix 32 and 64 bits component (DependencyWalker says)
  • the dll seems to not contain msvcr80.dll (DependencyWalker says)
  • the dll must provide function names 'in clear' (can be checked with DependencyWalker)
documentation/java-phreeqc-connection.txt · Last modified: 2015/08/20 09:19 by coligny