This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCJ .jar to .so with native method


Joe Hoffert writes:
 > Hi, Andrew.
 > 
 > On Tue, 2007-12-04 at 18:13 +0000, Andrew Haley wrote:
 > > Joe Hoffert writes:
 > > 
 > >  > You're right that using gcj or g++ to link doesn't matter. The
 > >  > difference with what I was doing before was the compiler/linker
 > >  > options.
 > > 
 > > Can you let us know what in our instructions didn't give you the
 > > information you needed?  It might help us improve our documentation.
 > 
 > I didn't see anything in gcj.pdf that talks about conflicting compiler
 > or linker options. The options that gave me trouble are the
 > -fvisibility=hidden and -fvisibility-inlines-hidden. When I take these
 > out the program compiles and links. I think I'll be fine without these
 > options.

Ah, OK.  I'm not sure we could fix that, even in principle: you may
well be the first person ever to experiment with changing symbol
visibility, and I would have had to try it to discover what would
happen.  OK, I could have guessed that it wouldn't work!

 > Now the program is aborting with the first "Java" call. I'm simply
 > calling a method specified by the gcjh generated header file. The code
 > is aborting from initializeClass:
 > 
 > (gdb) where
 > #0  0x00110402 in __kernel_vsyscall ()
 > #1  0x0084bfa0 in raise () from /lib/libc.so.6
 > #2  0x0084d8b1 in abort () from /lib/libc.so.6
 > #3  0x02da0d38 in _Jv_Throw () from /usr/lib/libgcj.so.8rh
 > #4  0x02ddc888 in java::lang::Class::initializeClass ()
 >    from /usr/lib/libgcj.so.8rh
 > #5  0x02dddd36 in _Jv_InitClass () from /usr/lib/libgcj.so.8rh
 > #6  0x00145a44 in
 > multishot.examples.RicochetApp.initialize(java.lang.String,
 > java.lang.String, int, java.lang.String)multishot.examples.RicochetApp
 > ()
 >    from /home/jhoffert/Ricochet/trimmed/c
 > ++-java/linux-jdk1.5/libricochet.so
 > #7  0x08048ec2 in main (argc=4, argv=0xbfca39e4) at
 > RicochetAppMain.cpp:95

You really did call JvCreateJavaVM() first, didn't you?

 > Is there I'm not doing when calling JvCreateJavaVM? I called this
 > initially with an empty JvVMInitArgs argument and the program
 > aborted so I added the -D option for the .jar file. This seems
 > redundant to me but I wasn't sure what else to try. This argument
 > is what I pass when I'm using the invocation API.
 > 
 > I appreciate your time but don't want to waste it. Please point me to
 > documentation, examples, or tutorials if you don't have time to keep
 > helping me.

You have the documentation.  :-)

When asking a question like this, you are far more likely to get an
answer if you submit a runnable test case.  That way I can see what's
going wrong.  Right now, I have no idea.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]