[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hint library name (was Re: Naming convention for Java gluelib

On Wed, Jun 10, 2009 at 9:18 AM, Matthew Johnson<mjj29@debian.org> wrote:
> On Wed Jun 10 09:14, Mathieu Malaterre wrote:
>> Can I add something like:
>> ...
>>     System.loadLibrary("foojni");
> Ah, yes, that is, in fact, how it works; you have to do this in order to
> load a native library. It will then look for lib${name}.so in
> $LD_LIBRARY_PATH and the java.library.path Java system property.

[For reference]
This was documented in the SWIG Java page:


The jniclasscode pragma is quite useful for adding in a static block
for loading the shared library / dynamic link library and demonstrates
how pragmas work:

%pragma(java) jniclasscode=%{
  static {
    try {
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load. \n" + e);

Thus application programmer do not need to know the actual name I
choose for the jni layer :)


Reply to: