libgcj_bc.so not embedded

Andrew Haley aph@redhat.com
Sat Apr 7 17:42:00 GMT 2007


Marco Trudel writes:
 > Andrew Haley wrote:
 > > Mohsen Saboorian writes:
 > >  > 
 > >  > > It's not supposed to be.  The idea is that you compile your program
 > >  > > and it dynamically links with the libgcj installed on the system.
 > >  > 
 > >  > Then what happens for example in Windows, where there is no such
 > >  > linkable library. Is it possible to statically link my program with
 > >  > this .so file so that there would be an absolute stand-alone
 > >  > application?
 > > 
 > > Not quite, but you can link using -static-libgcj.  It doesn't work for
 > > all Java programs,
 > 
 > Which ones doesn't work?

Anything that loads core classes via reflection or via its own class
loaders, as you must already know by now.

 > If you know how to manually add objects that 
 > are not referenced (and thus aren't pulled into the binary), then 
 > everything is fine. At least for me...
 > 
 > > and in general it's a bad idea.  Why do you want to
 > > do this, anyway?
 > 
 > There seem to be two different universes of GCJ users. Both do not 
 > understand why the other even exists. I also live in the one that only 
 > wants GCJ to create standalone binaries. I can't imagine a reason why to 
 > use GCJ as JVM...

 > GCJ is (for me), good to:
 > - get around the problem of telling users to install a JVM. If they have 
 > to install one anyway, why don't then just use one from Sun which has 
 > less bugs?

Aside from the technical reasons:

It's a different way of thinking about the world.  With free software,
we share libraries between applications.  That way, if a user of one
application finds a bug in a library, they report it and it gets
fixed, and all the other applications that link to the library get the
fix too.  By co-operating we all benefit.  By linking statically you
make sure that other users can't use the library code you have linked,
but you don't get their help either.

 > - better protect the written code

Protect it from what?  Alien invasion?  Herds of rampaging Wildebeest?  :-)

Andrew.

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



More information about the Java mailing list