Skip to content
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

"Expecting to find integer on stack" when using @Delegate #6

Open
jahewson opened this issue Oct 2, 2013 · 2 comments
Open

"Expecting to find integer on stack" when using @Delegate #6

jahewson opened this issue Oct 2, 2013 · 2 comments

Comments

@jahewson
Copy link

jahewson commented Oct 2, 2013

I'm getting a runtime exception when trying to use a delegate.

Exception in thread "main" java.lang.RuntimeException: java.lang.VerifyError: (class: foo/External$Lib$jnr$ffi$2, method: Process signature: (Lfoo/External$FailureCallback;J[B)Z) Expecting to find integer on stack
    at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:201)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:59)
    at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:43)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:228)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:201)

The code I'm using is simply:

 protected interface Lib  {
    boolean Process(byte[] data, Callback callback);
 }

 public static interface Callback {
    @Delegate public void call();
 }

The problem seems to be something to do with the parameter types because changing data from byte[] to long works fine.

@headius
Copy link
Member

headius commented Sep 26, 2016

Still a problem? If so, can you express this in terms of a PR with failing a failing test case?

@lionel-faber
Copy link

Hey @jahewson I'm trying to do something similar. But I'd like my call() function to have an argument. Eg:

public static interface Callback {
    @Delegate public void call(FfiResult result);
 }

Any idea how I can proceed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants