Solved

Compiling whit -G option

Posted on 2004-04-20
6
187 Views
Last Modified: 2010-04-01
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
Comment
Question by:MauricioGaviria
  • 2
6 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10872033
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
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 250 total points
ID: 10872149
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
 
LVL 3

Expert Comment

by:gkatz
ID: 10877357
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now