This is the mail archive of the mailing list for the Java project.

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

Re: static linking

Jeff Sturm wrote:

> 1) libsupc++ doesn't get linked by gcj
> This seems like an oversight.  Since is linked against libsupc++,
> normal (shared) linking just happens to work.  I "fixed" it by adding supc++ to
> libgcj.spec.  I'll see if I can cobble together a patch.

gcj shouldn't need to do anything special to get the supc++ stuff, it should all
be put into libgcj.a, the same way it gets built into libstdc++. libtool seems to
do this automatically for me. Does it not work for you?

> 2) classes loaded dynamically (via Class.forName) don't get linked
> I don't see any good solution.  I got around it by linking the following dummy
> class into my executable, but YMMV:
> class Dummy {
> dummy1;
>         gnu.gcj.protocol.file.Handler dummy2;
>         gnu.gcj.protocol.http.Handler dummy3;
>         gnu.gcj.protocol.jar.Handler dummy4;
> }

There's a linker flag which will force it to link in certain classes. Its a bit
ugly because you have to pass the mangled classname. Try something like
-Wl,-u,_Q53gnu3gcj8protocol3jar7Handler.class$ (untested).

The best solution, I think, would be to make a compiler option that allows you to
do this more easily. eg
"--link=gnu.gcj.protocol.jar.Handler,gnu.gcj.protocol.http.Handler" or something.


  [ bryce ]

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