New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: C callback cannot be resolved to a type #315

devent opened this Issue Jun 2, 2012 · 3 comments


None yet
2 participants
Copy link

devent commented Jun 2, 2012

I try to use jnaerator on libcryptsetup. I downloaded the libcryptsetup from the Google project site. libcryptsetup contains callback functions like:

void crypt_set_log_callback(struct crypt_device _cd,
void (_log)(int level, const char *msg, void *usrptr),
void *usrptr);

When I try to use jnaerator I get the error:

  1. ERROR in file:///test/ (at line 188)
    public static native void cryptSetLogCallback(Pointer<TestLibrary.crypt_device > cd, Pointer<TestLibrary.crypt_set_log_callback_log_callback > arg, Pointer<? > usrptr);
    TestLibrary.crypt_set_log_callback_log_callback cannot be resolved to a type

The jnaerator should have creates a new interface that extends from com.sun.jna.Callback, but it didn't, as in

I try to make a typedef declaration in libcryptsetup.h, but jnaerator just creates a native method for the typedef.

Here is my configuration for jnaerator:
<== config.jnaerator ==>
/// Define the name of the output library
-library Test

/// Add a directory to the include path
-I /home/devent/Sources/c/cryptsetup/lib
-I /usr/include/linux

/// Generate getters and setters for struct fields

/// Transform C names to Java-looking names : some_func() => someFunc()

/// output directory here
-o $(DIR)

/// (deprecated) Do not create an output JAR

/// (deprecated) Do not compile JNAerated headers

/// JNAerate libraries that use JNA's faster direct call convention

/// Generate a class entryclassName.EntryClassName that will contain all of
/// the jnaerated libraries instances. . User code will just need to static
/// import or derive from this class to access to the instances.

/// Force the overwrite of existing files

// -mode Maven
-mode Jar

/// The header files


This comment has been minimized.

Copy link

ochafik commented Jun 4, 2012

Hi @devent ,

Thanks a lot for your report !

This bug is caused by the -beautifyNames switch, which you remove as a workaround. I'm working on a fix as I write.


ochafik added a commit that referenced this issue Jun 5, 2012

JNAerator: change the way names beautification is performed (moved to…
… missing names choice and function name choice) (issue #315)

This comment has been minimized.

Copy link

devent commented Jun 10, 2012

Thank you very much, now the code is generated. Of course the names are all C style with underscores.


This comment has been minimized.

Copy link

ochafik commented Oct 4, 2012

Closing this bug since bug is fixed and there's no plan to change beautification in the near future.

@ochafik ochafik closed this Oct 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment