gcj, library, external packages

Florian Bourgier fbourgier@sycomore-multimedia.com
Wed Jul 21 16:22:00 GMT 2004


Hello,

 I have some problems with gcc to build a library.
 
 I have Java classes that uses external package (castor, xerces, log4j, 
...).
 
 I want to use these java classes with c++ applications. So I use gcj to 
make .o of all the jar I have
 (fw.jar contains my class)
 
gcj -c ./src/activation.jar -o ./classes/activation.o

gcj -c ./src/mail.jar -o ./classes/mail.o --classpath="./src/activation.jar"

gcj -c ./src/xerces.jar -o ./classes/xerces.o

gcj -c ./src/castor-xml.jar -o ./classes/castor-xml.o 
--classpath="./src/xerces.jar;./src/ant.jar"

gcj -c ./src/jakarta-log4j.jar -o ./classes/jakarta-log4j.o --
classpath="./src/mail.jar;./src/jmxri.jar;./src/jms.jar;./src/xerces.jar"

gcj -c ./src/fw.jar -o ./classes/fw.o 
--classpath="./src/activation.jar;./src/mail.jar;./src/jakarta-log4j.jar;./src/jmxri.jar;./src/servlet.jar;./src/castor-xml.jar"

It was ok.

Then I made a very simple C++ program with object of my classes (after 
having generate headers with gcjh)

g++ -c Exemple.c -o Exemple.o -I'directory with my headers'

and then when i want to link

g++ *.o -o Exemple.exe

It breaks. Because some of the package needs soem classes (for exemple 
castor needs ant and etc..).
But i dont want to compile everything. I know my applications needs not 
all these things.

So i tried to make a library (static or dynamic) and it breaks too. 
(needs classes)

Can you help me ?
What options in gcc can I activate ?

Thanks
Regards

Florian



More information about the Java mailing list