I'm trying to get the Java ZomB bindings working, and I seem to be having an issue with getting returned C strings (a const char* to be exact). I have this function:
Code:
private static final Function getstringfnc = NativeLibrary.getDefaultInstance().getFunction("ZomBDashboardGetString");
public String GetString(String name)
{
int returnstring = getstringfnc.call1(Pointer.createStringBuffer(name));
return Pointer.NativeUnsafeGetString(Address.fromPrimitive(returnstring));
}
and this C declaration:
Code:
extern "C"
{
const char* ZomBDashboardGetString(const char* name);
}
and every time I call GetString("value"), my program dies (but it stills says code on the DS). I can, however, pass strings to functions fine.
Java Source attached, C header and out file are on FIRST Forge (just use
the latest build's installer, and its in C:\Program Files\ZomB\Bindings)