I barely understand what a struct is other than sorta like a class in java. I want to use processing and java to provide the input and then get the result back to java. I went to this link and found some code I want to use: celestial navigation I tried the code and like how simple it is to use. I know its out of date, but I can fix that eventually. I then went to here: https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html and learned a little about JNI . I also found an example of using JNI with processing: https://processing.org/discourse/beta/num_1147602703.html
I got that example to work!
The problem I have is what do I put in my java class if I want to use this C struct. I know I have to declare static native, etc. but I’m lost with what to do with a struct.
Here’s the C struct:
struct COMPLX getlatlng(struct COMPLX *x,int prompt)
{
int i = 0;
double a;
if(prompt)
{
if(!comline)
myputs(
"Enter estimated position as (lat) dd mm.mm [N/S] (lng) ddd mm.mm [E/W]\n:");
}
getsptr = mygets(inbuf,buflen);
split(inbuf);
a = x->lat;
i = llscan(i,&a);
x->lat = a;
a = x->lng;
i = llscan(i,&a);
x->lng = a;
}
Edit: I think I’ll try something easier in that C program to bridge for a first try.