Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Compiling whit -G option

hi experts

I need to create a library to make a conection whith Java using native interface.

I'm trying to create a source file with -G option but it doesn't work. I use the cc, gcc and g++ but any of that recognize that option.

Any idea about my trouble?

Thanks.
0
MauricioGaviria
Asked:
MauricioGaviria
  • 2
1 Solution
 
Karl Heinz KremerCommented:
What is -G in your opinion?

On my system the man page lists this:

  -G num
           On embedded PowerPC systems, put global and static items less than
           or equal to num bytes into the small data or bss sections instead
           of the normal data or bss section.  By default, num is 8.  The -G
           num switch is also passed to the linker.  All modules should be
           compiled with the same -G num value.


... and I suspect this is not what you want.
0
 
Karl Heinz KremerCommented:
This page http://jan.netcomp.monash.edu.au/internetdevices/jni/lecture.html has a pretty short and simple example of how to use JNI with gcc. Are you doing something similar (but more complex)?
If so, try the example and see if your process is wrong. If this example is not comparable to your project, please post more information.
0
 
gkatzCommented:
I'm not sure why you need the -G option.  I've compiled native interface code to work with java using the CC compilier.  The sun webpage gives an example using
cc -I<where jni.h is> -L<where libjava.so is> -ljava myfile.c

Also if you are running a solaris machine you need to set your LD_LIBRARY_PATH  to point to libjava.so and when you create your new library you need to add the directory that holds that to your LD_LIBRARY_PATH also.  

Hope it helps.  If you are still running into trouble please post why you are using the -G option for making your library.  

Thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now