Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Compiling whit -G option

Posted on 2004-04-20
6
Medium Priority
?
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 750 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

688 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