bodensx / jnaerator

Automatically exported from code.google.com/p/jnaerator
0 stars 0 forks source link

-runtime JNA option does not work #95

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run jnaerator through command line:
java -jar jnaerator-0.9.7.jar -noComp -noJar -gccLong -library Attemperator 
-beanStructs -package com.test.attemperator.jna -runtime JNA -I 
attemperator-headers attemperator-header/MainHeader.h

2. Then, try to run with -runtime JNAerator 

They all generate the same code for loading library:

    public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("Attemperator", true, com.test.attemperator.jna.AttemperatorLibrary.class);
    public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(com.test.attemperator.jna.AttemperatorLibrary.JNA_LIBRARY_NAME, com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper.DEFAULT_OPTIONS);
    public static final AttemperatorLibrary INSTANCE = (AttemperatorLibrary)Native.loadLibrary(com.test.attemperator.jna.AttemperatorLibrary.JNA_LIBRARY_NAME, com.test.attemperator.jna.AttemperatorLibrary.class, com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper.DEFAULT_OPTIONS);

What is the expected output? What do you see instead?
If we turn on the JNA option, it should load in the class throught JNA, like 
this:
    public static final String JNA_LIBRARY_NAME ="CPP_testDLL.dll";
    public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(JNA_LIBRARY_NAME);
    public static final AttemperatorLibrary INSTANCE = (AttemperatorLibrary)Native.loadLibrary(JNA_LIBRARY_NAME, AttemperatorLibrary.class);

What version of the product are you using? On what operating system?
jnaerator 0.9.7, Windows XP

Is the problem still present in the latest SVN version ? (you can easily
build from sources with these instructions :
http://code.google.com/p/javacl/wiki/Build)

Please provide any additional information below.

Original issue reported on code.google.com by LiuYJe...@gmail.com on 19 Aug 2011 at 10:07

GoogleCodeExporter commented 8 years ago
Hi,

Thanks a lot for your report !
I've committed a fix and redeployed a new 0.9.9-SNAPSHOT version on Maven :
https://github.com/ochafik/nativelibs4java/commit/e865aae1f894a189ebb449eb0fdde5
6c490a3d71

Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 30 Aug 2011 at 1:54