Article on GCJ

Weiqi Gao weiqigao@networkusa.net
Wed Jan 22 02:48:00 GMT 2003


On Tue, 2003-01-21 at 19:41, Anthony Green wrote:
> On Mon, 2003-01-20 at 20:03, Weiqi Gao wrote:
> > Please if you have a few munites can you take a look at the article? 
> > And let me know if the information therein is still valid, correct,
> > up-to-date and useful.
> 
> This is a good introduction to gcj.  Perhaps we should put a link to it
> or copy it into the FSF's gcj page.

Thank you Anthony.  The permenant URL of this article is
http://www.ociweb.com/jnb/jnbJan2003.html.

> The only nit I caught is that it's always best to recommend using "gcj"
> to link any application using libgcj.  Your CNI invocation example uses 
> g++.  The reason you should use gcj is that it knows to bring in target
> specific libraries required by libgcj (like winsock on Windows).  I
> believe you can just replace "g++" with "gcj" and your example will
> still work. Gcj should know enough to invoke the C and C++ compilers
> when required (although -D might not work, because gcj overloads that
> option).

I tested with the stock Red Hat Linux 8.0 GCJ (3.2).  Since I'm using
C++'s std::string as will as Java, I either have to use

$ gcj -o invoke invoke.cc -lstdc++

or

$ g++ -o invoke invoke.cc -lgcj

I'll change it into "gcj -o invoke invoke.cc -lstdc++".

> AG
-- 
Weiqi Gao
weiqigao@networkusa.net



More information about the Java mailing list