My goal is to use MathLink to access the functions in sofa (Standards of Fundamental Astronomy)
So far I have had mixed success. I have very little C programing experience so I am hoping to get access to these algorithms via MathLink.
I have a very simple C code file that loads the sofa libraries:
#include "mathlink.h"
#include <stdio.h>
#include "sofa.h"
#include "sofam.h"
int main(int argc, char* argv[])
{
return MLMain(argc, argv);
}
Then, from the sofa documentation I find function definitions like:
double iauAnp(double a)
Which I then turn into inputs, in the sofa.tm file
:Begin:
:Function: iauAnp
:Pattern: iauAnp[i_Real]
:Arguments: { i }
:ArgumentTypes: { Real64 }
:ReturnType: Real64
:End:
:Evaluate: iauAnp::usage = "iauAnp[x] Normalize angle into the range 0 <= a < 2pi."
I'm then able to compile this and load it into Mathematica via the Install[]
function. So I know I can turn the crank once for a simple case.
The question: How do I write the lines for the sofa.tm file for the following function?
void iauC2i00a(double date1, double date2, double rc2i[3][3])
My understanding of the workings of this function is that date1
and date2
are inputs and the 2D array, rc2i
is returned by reference.
I would like the Mathematica function to look like this:
rc2i = iauC2i00a[date1, date2]