javacpp
javacpp copied to clipboard
How to parsing function pointer that has mutidimensional array parameter?
// in header file
int (* testFunc)(char[][256] value);
// in generated java file
public static class TestFunc_BytePointer extends FunctionPointer {
static { Loader.load(); }
public TestFunc_BytePointer (Pointer p) { super(p); }
protected TestFunc_BytePointer () { allocate(); }
private native void allocate();
public native int call(@Cast("char*") BytePointer errorList);
}
// generated native jni file
struct JavaCPP_hidden JavaCPP_org_bytedeco_test_ClassName_00024TestFunc_1BytePointer{
JavaCPP_org_bytedeco_test_ClassName_00024TestFunc_1BytePointer() : ptr(NULL), obj(NULL) { }
int operator()(char* arg0);
int (*ptr)(char* arg0);
jobject obj; static jmethodID mid;
};
=> compile error error C2440: '=': cannot convert from 'int (__cdecl *)(char [][256])' to 'int (__cdecl *)(char *)'
The Parser is probably going to have a hard time with that. Try to output the definition using Info.javaText: https://github.com/bytedeco/javacpp/wiki/Mapping-Recipes#mapping-a-declaration-to-custom-code
@saudet How to select call method of Function Pointer?
I tried new Info ("ClassName::testFunc")
but it doesn't work.
It's probably picking it up as int (*)(char*)
.
@saudet Oh, thank you! I'll give it a try!