static linking
Jeff Sturm
jeff.sturm@appnet.com
Tue Dec 5 18:42:00 GMT 2000
Bryce McKinlay wrote:
> 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?
No. I get undefined references to std::terminate, etc.
> 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).
That gets ugly quick if there are many such classes. I didn't mean to
suggest there are only four; that was just enough to make my app work.
The Dummy class is a convenient (albeit gross) workaround that somebody
might find useful until static linking gets fixed in libgcj. I don't
think the current situation is satisfactory. One consideration is
platforms (i.e. win32) on which a shared libgcj isn't currently an
option.
> 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.
One way to accomplish that could be to pass the --link option to
jvgenmain and let it mangle the class, just as it does now for the main
class.
Jeff
More information about the Java
mailing list