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

‘arg0’ was not declared in this scope #99

Closed
ReneHollander opened this issue May 19, 2016 · 3 comments
Closed

‘arg0’ was not declared in this scope #99

ReneHollander opened this issue May 19, 2016 · 3 comments
Labels

Comments

@ReneHollander
Copy link

The generated C++ code sometimes wants to use an argument arg0 that is not declared in the function protoype. I assume that the issue is on my end, because it worked before. I didn't work on the project for a few months and I can't recall if it actually worked or how to fix it. The provided code is only from one of the methods that wants the arg0 argument. There are many more that aren't declared correctly.
But I am also getting the following warnings from the Generator:

Warning: First parameter of caller method call() or apply() for member function pointer org.duktape.duktapejava.Duktape.Function is not a Pointer. Compilation will most likely fail.
Warning: First parameter of caller method call() or apply() for member function pointer org.duktape.duktapejava.Duktape.FatalHandler is not a Pointer. Compilation will most likely fail.
Warning: First parameter of caller method call() or apply() for member function pointer org.duktape.duktapejava.Duktape.Function is not a Pointer. Compilation will most likely fail.
Warning: First parameter of caller method call() or apply() for member function pointer org.duktape.duktapejava.Duktape.FatalHandler is not a Pointer. Compilation will most likely fail.

I debugged the Generator a little, and all the warnings are caused by the allocate function not having an argument that is a Pointer.

GCC output:

/home/rene/Dropbox/Code/duktape-java/build/tmp/native/duktape-java-linux-x86_64.cpp: In function ‘int JavaCPP_org_duktape_duktapejava_Duktape_00024Function_allocate_callback()’:
/home/rene/Dropbox/Code/duktape-java/build/tmp/native/duktape-java-linux-x86_64.cpp:1384:93: error: ‘arg0’ was not declared in this scope
     return JavaCPP_org_duktape_duktapejava_Duktape_00024Function_allocate_callback_instance(arg0);
                                                                                             ^

Snipped from the generated C++ code:

JNIEXPORT int JavaCPP_org_duktape_duktapejava_Duktape_00024Function_allocate_callback() {
    return JavaCPP_org_duktape_duktapejava_Duktape_00024Function_allocate_callback_instance(arg0);
}

The used Java definition:

@org.bytedeco.javacpp.annotation.Namespace("")
public static abstract class Function extends org.bytedeco.javacpp.FunctionPointer {

    static {
        LibraryLoader.load();
    }

    public Function() {
        allocate();
    }

    private native void allocate();

    public abstract int call(duk_context ctx);

}
@Namespace("")
@Name("duk_context")
public class duk_context
    extends Pointer
{

    static { org.duktape.duktapejava.LibraryLoader.load(); }
}
saudet added a commit that referenced this issue May 21, 2016
@saudet saudet added the bug label May 22, 2016
@saudet
Copy link
Member

saudet commented May 22, 2016

Fixed in the latest commit above. Thanks for reporting!

@ReneHollander
Copy link
Author

Are you planning to release a patch? Setting the Namespace to "" is mandatory if someone wants to generate bindings for C code.

@saudet
Copy link
Member

saudet commented May 26, 2016

Fix included in version 1.2.1!

@saudet saudet closed this as completed May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants