nativelibs4java / JNAerator

JNAerator: native bindings generator for JNA / BridJ / Node.js
http://jnaerator.googlecode.com
510 stars 109 forks source link

JNAerator generates uncompilable Java for GnuTLS header for BridJ runtime #62

Open ochafik opened 9 years ago

ochafik commented 9 years ago

From @rdicroce on March 18, 2014 20:32

I attempted to run the GnuTLS header through JNAerator using the BridJ runtime instead of JNA after I had the problems described in #485. The command I used was the same except for -runtime.

The generated GnutlsLibrary.java file contains these non-existent imports: import gnutls_params_st.gnutls_dh_params_t; import gnutls_params_st.gnutls_rsa_params_t; import gnutls_retr2_st.gnutls_openpgp_privkey_t; import gnutls_retr2_st.gnutls_x509_crt_t; import gnutls_retr2_st.gnutls_x509_privkey_t;

Some of the other generated files have similar errors.

Copied from original issue: ochafik/nativelibs4java#487

ochafik commented 9 years ago

From @josemrecio on March 20, 2014 11:24

As a workaround, parsing the full gnutls.h in smaller chunks (or taking just what you need) works fine.

For reference, the declaration of gnutls_dh_params_t is below; it is a pointer to an opaque struct, similar for the other reported cases. Note however that gnutls_session_t is declared following the same pattern and it is not reported as failing.

gnutls.h for the last GnuTLS release can be found at https://gitorious.org/gnutls/gnutls/source/9e385114542e38373f1a6640930e7cc5f29b8657:lib/includes/gnutls/gnutls.h.in#L742-1450

[...]
struct gnutls_session_int;
typedef struct gnutls_session_int *gnutls_session_t;

struct gnutls_dh_params_int;
typedef struct gnutls_dh_params_int *gnutls_dh_params_t;

struct gnutls_ecdh_params_int;
typedef struct gnutls_ecdh_params_int *gnutls_ecdh_params_t;

[...]