Native library loading in Java is a bit brittle
In FileUtils.loadLibrary()
, it searches for the libName
(i.e., PulseJNI
) followed by "." or "d.". It then checks to see if exactly 1 file was found by either search. The problem is, this really restricts where the libraries can be. E.g., I was trying to have all the debug libs in a single directory with their pdb files, but the pdb files cause there to be 2 matches, so then it falls through to the default case, which tries to load the non-debug libs.
I assume the files are being looked for in this particular way to avoid dealing with platform-specific suffixes. Instead of this approach, you could do this: System.mapLibraryName(libName)
and System.mapLibraryName(libName + "d")
.
Additionally, I wonder if it would be possible to allow a user to specify whether they want the release or debug libs. If this capability existed, then both versions could be in the same directory (currently, if both are present, it will load the release libs).