I'm trying to understand if the file that was provided to me is something I can use Jave Native Interface with, where I can write a Java class and create native abstract methods corresponding to C functions in the .h header file.
So, what I have now is a .ec file and .h file. Both were provided to me.
I was asked to try to use JNI to invoke functions from .ec file.
However, I noticed that some common JNI keywords like JNIEXPORT, JNICALL, JNIEnv*, jobject are NOT present in either .ec or .h files that was given to me.
The .h file looks like this :
#ifndef _BITMAP_H
#define _BITMAP_H 1
struct BITMAP
{
char *buffer; // buffer
int ax; // width
int ay; // height
int size; // buffer size
};
struct BITMAP *create(int ax, int ay);
void close( struct BITMAP *pbmp );
void drawLn( struct BITMAP *pbmp, int x1, int y1, int x2, int y2 );
void drawTxt(struct BITMAP *pbmp, char *szText, int x, int y );
void setPxl( struct BITMAP *pbmp, int x, int y );
#endif
Is this a valid file to use JNI with? I'm a total beginner with JNI but I suspect, and it looks like JNI is not applicable to this kind of file definition.
Are there other Java technology or library to invoke these methods from .ec file?
I'd appreciate any comment or explanation.
Thank you.
Answer is NO its not a valid header file. You don't look at java native code and try to create a header file by hand instead you let javac generate the header file for you using the -h option
Javac will compile class files containing native methods and will output the header files for you. Documentation here