Using Embarcadero\'s Jni api unit, how does one supply variable argument lists to the JNI methods that require it? For example, the CallStaticObjectMethodV() method of the JNINa
The va_list
needs to point to a block of memory that matches what would be pushed onto the stack if you had instead called a variadic function.
The usual implementation of va_start
simply yields the address of the location on the stack where the variadic arguments were pushed.
#define va_start(ap, parmN) ((void)((ap) = (va_list)((char _FAR *)(&parmN)+__size(parmN))))
So your attempt to make an array containing the arguments, and use that as your va_list
ought to work. Perhaps you've given up on it too hastily? Perhaps instead of:
Move( Str1, Data[0], Sz);
Move( Str1, Data[Sz], Sz);
you meant
Move( Str1, Data[0], Sz);
Move( Str2, Data[Sz], Sz);
Although personally I'd opt for a array of JNIString
rather than a byte array.
So perhaps your approach to create the va_list
is fine, but the failure is caused by an error elsewhere.