1

We need to integrate some C file functions from java android code. Each c function accepts some raw binary data (byte stream) as input parameter, processes and returns pointer to c struct (union struct) that is defined in c file. Is it possible to create some java structure and bind it to c struct? Currently, extraction of returned data (returned c structs) is performed extracting byte by byte in java code, not by accessing struct members directly.

Centurion
  • 14,106
  • 31
  • 105
  • 197
  • possible duplicate - http://stackoverflow.com/questions/3923299/how-to-pass-c-structs-back-and-forth-to-java-code-in-jni – therin Nov 28 '12 at 09:12
  • You need to look at the JNI - the *Java Native Interface*. I would stay away from the NDK (Native Development Kit) if I were you. – cdarke Nov 28 '12 at 09:12
  • Thanks for info, probably missed that post – Centurion Nov 28 '12 at 09:18

1 Answers1

0

I'm not sure of the specifics, but I think the Java Native Interface is your best bet.

therin
  • 1,448
  • 1
  • 15
  • 27