Faisal Abid
Faisal Abid

Reputation: 9140

Does Java pass by reference or value to C when using JNI ( more specifically Android NDK)

Does Java pass by reference or value to C when using JNI ( more specifically Android NDK)

Upvotes: 3

Views: 2746

Answers (2)

Keith Randall
Keith Randall

Reputation: 23265

I can't speak to Android, but JNI passes values just like Java does, primitive types are passed by value and all objects (including arrays) are passed by reference. The wiki article on JNI is pretty good.

Upvotes: 1

user205622
user205622

Reputation:

It depends on the type. Primitive types are passed by value and reference types by... reference. See http://java.sun.com/docs/books/jni/html/types.html

Upvotes: 6

Related Questions