I want to use for example a library written for a specific mathematic calculation in C with renderscript. I want to know is it possible to add them like include <'math.h'> . to be more specefic the library is about ordinary differential equations (well known in matlab with ode23).
Asked
Active
Viewed 131 times
1 Answers
3
No, you cannot include C code in your renderscript files.

Larry Schiefer
- 15,687
- 2
- 27
- 33
-
Why? so what can i do if it is an important library? – Shahryar Jul 23 '16 at 14:14
-
Renderscript is not C or C++. It is ultimately compiled into something platform specific. It could be assembly for the application processor, an onboard DSP or the GPU. You either need to rewrite the code for RS or just use JNI to call the C code from Java. – Larry Schiefer Jul 24 '16 at 02:35
-
So you mean i have to use NDK? – Shahryar Jul 24 '16 at 03:50
-
or is it possible to use JNI with renderscript too? – Shahryar Jul 24 '16 at 04:16
-
You can call renderscript from NDK code, but not the other way around. – Larry Schiefer Jul 24 '16 at 12:56
-
@LarrySchiefer Hi do you have an example of calling rs from NDK code? THX – Coroner_Rex Feb 15 '17 at 02:58
-
Have a look at the samples in the ndk, I believe the is a rs example. – Larry Schiefer Feb 15 '17 at 10:54