compiling with gcj
Adam Satcowitz
adam@planbtechnologies.com
Thu Mar 13 05:25:00 GMT 2003
hi,
i have a class called SendMailMessage and another class called
TextTools. static functions in TextTools are called in
SendMailMessage. it looks to me like the linking is failing these calls.
i have been researching this for hours. i found your article related to
what i am experiencing. i think this is the same problem. unfortunately,
i can't figure out how to compile jar files into native code that i can use
with gcj. i bet it is something simple and yet it eludes me.
the error i am getting is
i type: gcj --main=SendMailMessage
d:\inetpub\classes\com\planbtechnologies\SendMailMessage.java
i get:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccqKaaaa.o: In function
`ZN15SendMailMessage4mainEP6JArrayIPN4java4lang6StringEE':
d:/inetpub/classes/com/planbtechnologies/SendMailMessage.java:32: undefined
reference to `com::planbtechnologies::TextTools
::parseOnString(java::lang::String*, java::lang::String*,
java::lang::String*, bool)'
any help would be appreciated. email me directly as well as responding to
the list.
many thanks.
adam
if this helps, there was a thread on this a while ago and i could not make
sense of it:
From: Mark Anderson <mark at panonet dot net>
To: java at gcc dot gnu dot org
Date: Mon, 21 Oct 2002 14:10:33 +0100
Subject: Linking question
--------------------------------------------------------------------------------
I have just started using gcj and I am trying to compile some code into native
form. This code relies on other code found in JAR files which I have
specified using -I.
An example of the command I am using is given below along with its output:
gcj --main=LinkTest -Iutil_jar.jar -o LinkTest LinkTest.java
/tmp/ccigNOif.o: In function `LinkTest::main(JArray<java::lang::String*>*)':
/tmp/ccigNOif.o(.text+0x44): undefined reference to
`com::ravnaandtines::util::text::Hexprint::fmt(int)'
collect2: ld returned 1 exit status
I understand that the error is being caused because the com....Hexprint class
is not availble in a library as native code. However, I thought that with gcj
you could mix native and bytecodes.
Therefore, my question is do I need to compile the JAR file to native code or
is there any way I can create my binary without doing this?
--
Regards,
Mark
and the response was:
On Mon, 2002-10-21 at 06:10, Mark Anderson wrote:
> Therefore, my question is do I need to compile the JAR file to native
code or
> is there any way I can create my binary without doing this?
You either need to compile the JAR file to native code, or restructure
your program so no references to Hexprint appear in your program. This
means you're pretty much limited to whatever you can manage with
Class.forName(). There are a few approaches you can try... reflection,
abstraction, proxies...
Perhaps one day we'll be able to make what you're asking for work.
AG
Adam Satcowitz
Plan B Technologies, Inc.
212.242.5654
More information about the Java
mailing list