Linking ?

Bryce McKinlay bryce@waitaki.otago.ac.nz
Wed Oct 10 17:13:00 GMT 2001


Torsten Rüger wrote:

> how do I link when I can't compile all the classes.
>
> In other words, how do I mix native code and class files (my main is 
> compiled, but of course I could change that)
>
> Currently I get link errors (because the .class files have not been 
> complied) and I don't even get a an executable, 


There isn't a way to link compiled code against a .class file. That is, 
the compiled code can't contain actual references to classes that are 
not compiled. You can, of course, dynamically load a class file with 
.forName() and call into it via an interface or superclass which is 
known to both the compiled code and the bytecode, or via reflection.

It would be possible to add a dynamic loading/linking ability to the 
compiler, however. Here are some threads where you can read my rants 
about this:

http://gcc.gnu.org/ml/java/2001-05/msg00115.html

http://gcc.gnu.org/ml/java/2001-03/msg00180.html

regards

Bryce.




More information about the Java mailing list