Solved

Compiling whit -G option

Posted on 2004-04-20
6
196 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

863 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

21 Experts available now in Live!

Get 1:1 Help Now