Thank you for your work with simplifying the native interface!
I am trying to create a Java API for Matlab by calling the current C
API using JNA.
I am a graduate aerospace student working in a spacecraft design lab.
Much of what we do uses Matlab but I would like to transition one tool
to Java/Fortran. During the interim, some legacy modules will still
need to be run using Matlab which is motivating my desire for a Matlab
Java API.
This is the lions share of the API that I will need to wrap:
Engine - A handle to a MATLAB engine object.
int engClose(Engine *ep);
int engEvalString(Engine *ep,const char *string);
int engGetVisible(Engine *ep, bool *value);
Engine *engOpen(const char *startcmd);
Engine *engOpenSingleUse(const char *startcmd, void *dcom, int *retstatus);
int engOutputBuffer(Engine *ep, char *p, int n);
int engSetVisible(Engine *ep, bool value);
mxArray - The fundamental type underlying MATLAB data.
mxArray *engGetVariable(Engine *ep, const char *name);
int engPutVariable(Engine *ep, const char *name, const mxArray *pm);
An example of using this would be:
main()
{
Engine * ep;
char * buffer;
ep = engOpen("matlab ");
buffer = mxCalloc(101,sizeof(char));
engOutputBuffer(ep, buffer, 100);
if (engEvalString(ep,"d=eye(3)"))
fprintf(stderr,"Error evaluating d=eye(3)");
else
printf("Result of engEvalString is \n%s\n",buffer);
mxFree(buffer);
}
Given the signatures for these functions, is there any advice on using
JNA that comes to mind? This will be my first go at calling a native
interface so a nudge in the right direction would be most appreciated.
thank you,
Richard