Add annotations to optimize copying data in to/out of native code, and correct length parameters to be unsigned long long