I’m trying to call a Java constructor with named parameter from a JNI DLL. How does its name get formatted? From the DLL I normally call JNI’s GetMethodID function, passing it the method name and signature. This works well but I’m a little unclear as to what the name will be for a constructor with a named parameter.
Normal Java constructor with int parameter:
name = “[init]” (using lesser/greater than characters, not square brackets)
signature = “(I)V”
I was trying to find out the answer by myself but couldn’t figure out where to retrieve this info from.
TBH I’m not sure, since Enums aren’t classes and don’t really get .ctors; I’d expect that the compiler would just generate the underlying JVM equivalent for creating an enum value — but this is a bit beyond my area, I’m afraid, we’ll need to wait for Carlo to answer this.
Really the easiest is to use something like https://github.com/Konloch/bytecode-viewer to see what gets generated. I think you get a plain integer, so just passing a Jint with value 0 will do.