JNI Calling C and Informix
Dear All,
I have these program written in Informix7 and C.
The problem is I need to call both program through Java JNI program.
Well, below is my steps:
1.I create java program called Average.java
2.Compiled using javac Average.java --> got Average.class
3.Create header file using javah -jni Average --> got Average.h
4.I created C native program called AverageImp.c
5.Now the problem is:
- This C program is linked with Informix object file (lets say Client.4gl/o).
- ..using fgl_start() and fgl_call() inside fglapi.h include file.
- Now how do I linked both program and create shared library in
the system?
- Do I use cc -G or c4gl -c or ld -G ?
- Which compiler should I used...C or Informix?
Please anybody can help me?
Thanks for your attention.
-buyong 006-03-9802643-
Re: JNI Calling C and Informix
I don't remember exact command line arguments but the solution is you have
to create an position independent object file using C compiler. I think
you can use ar command in unix to create such position independent object
file and keep that file in your SHLIB_DIR. I hope this solves your problem.
"Buyong H Hussain" <buyong@rhb.com.my> wrote:
>
>Dear All,
>
>I have these program written in Informix7 and C.
>The problem is I need to call both program through Java JNI program.
>Well, below is my steps:
>
>1.I create java program called Average.java
>2.Compiled using javac Average.java --> got Average.class
>3.Create header file using javah -jni Average --> got Average.h
>4.I created C native program called AverageImp.c
>5.Now the problem is:
> - This C program is linked with Informix object file (lets say
Client.4gl/o).
> - ..using fgl_start() and fgl_call() inside fglapi.h include file.
>
> - Now how do I linked both program and create shared library in
>the system?
> - Do I use cc -G or c4gl -c or ld -G ?
> - Which compiler should I used...C or Informix?
>
>Please anybody can help me?
>
>Thanks for your attention.
>
>-buyong 006-03-9802643-
>
>
>