hzzc1987 / jnaerator

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

const char pointer problem #94

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
test.h contains "#define TEST_DATA       ((const char *)"general")"

Did "java -jar jnaerator-0.9.8-shaded.jar -library test test.h -o . -v -noJar 
-noComp" on Solaris 5.10 x86

Generated java file contained "public static final Pointer TEST_DATA = 
(Pointer)("general");" which gives the compilation error "Cannot cast from 
String to Pointer".

Original issue reported on code.google.com by milive...@gmail.com on 18 Aug 2011 at 1:58

GoogleCodeExporter commented 8 years ago
I'm not able to submit a new issue. So adding this problem in this issue itself.

test.h contains:
int test(uint_t, void *,
    int (*callback)(int *, int *, void *));

Did "java -jar jnaerator-0.9.8-shaded.jar -library test test.h -o . -v -noJar 
-noComp -beautifyNames" on Solaris 5.10 x86

Generated java file contained:
        public interface testArg1CallbackCallback extends Callback {
                int apply(IntByReference intPtr1, IntByReference intPtr2, Pointe
r voidPtr1);
        };
        /**
         * Original signature : <code>int test(void*, test_arg1_callback_callbac
k)</code><br>
         * <i>native declaration : test.h:1</i>
         */
        @Mangling({"_Z4testPvPFiPiPiPvE", "?test@@YAHPAXPFHPAHPAHPAX@E@Z"})
        int test(Pointer voidPtr1, TestLibrary.test_arg1_callback_callback arg1)
;

This gives a compilation error as TestLibrary.test_arg1_callback_callback 
cannot be found.

The name should have been changed here too.

Original comment by milive...@gmail.com on 18 Aug 2011 at 2:22

GoogleCodeExporter commented 8 years ago
Another one:

test.h contains:
typedef struct int *version_t;
#define VERSION     ((version_t)1UL)
#define SUCCESS                     0

Did "java -jar jnaerator-0.9.8-shaded.jar -library test test.h -o . -v -noJar 
-noComp
 -gccLong" on Solaris 5.10 x86

Generated java file contained:
        public static final int SUCCESS = (int)0;
But the variable VERSION was missing.

Original comment by milive...@gmail.com on 18 Aug 2011 at 2:51

GoogleCodeExporter commented 8 years ago
Hi,

Thanks a lot for your reports (could you please try opening new tickets for 
further issues ? It helps keep trak of things whenever I'm unable to fix all 
the problems at the same time).
I've deployed a fix for the string constant issue in 0.9.9-SNAPSHOT (only for 
JNAerator and BridJ runtimes, since there does not seem to be a 
direct-expression way of creating a String constant in pure JNA) :
https://github.com/ochafik/nativelibs4java/commit/b50e99832bd9460909640ba4fe967a
df7a479784

Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 30 Aug 2011 at 2:23

GoogleCodeExporter commented 8 years ago
Hi,
This issue moved to Github :
https://github.com/ochafik/nativelibs4java/issues/167

Thanks for not updating this page anymore and adding further comments on Github.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 1 Sep 2011 at 7:27