|Charles Boyd on Thu, 25 Aug 2011 07:16:12 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: embedding GP in GUI applications (android-port)|
I have produced a statically compiled GP binary for Android, and now want to build a light graphical application to improve the usability of PARI/GP on Android.
Android applications are written in Java, and may interface with native C/C++ functions via the Java Native Interface (JNI).
Is there a relatively simple way to send commands for evaluation by GP from an external application?
For example, if it is possible to embed the GP interpreter in a C program (similar to Python embedding) -- then I could write a small wrapper library in C that interfaces with GP and then load this library in the Java GUI application via JNI. For example, this library would provide simple functions...roughly prototyped as:
// return a file descriptor for the gp process, or error status
// evaluate a gp command and return output, or error message
const char *gp_eval(const char *cmd);
// terminate the gp process, returning exit status
int gp_kill(int pid);
Any suggestions/ideas about how to do this are greatly appreciated, as always.