Re: [Java] Function Binding Redux (long post)
John Moeller <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Message-ID | <[email protected]> |
Rene Rivera wrote: > Rene Rivera wrote: >> What I don't >> know is how the Java compiler could be made to work without actual >> *.class files. > > Thinking a bit more about this... It should be easy to create a test for > this. Just: > > * Create a Java source file which declares a native class. > * Compile that to the *.class equivalent. > * Write a library that implements the basic algo I mentioned, but is > hardwired to: > * Load in the contents of the *.class file. > * Bind a method from the Java class to an arbitrary C++ function. > * Create a second Java class that subclasses, or otherwise uses, the > library class and that does the System.loadLibrary before defining the > class. > * Try and compile the new class. I think I see where you're going, but it won't work. At the point where you "subclass or otherwise use" and then compile, the compiler will error out. If the compiler can't find the dependent class, the target class will fail to compile. I tried this. Additionally, as I explain in more detail in my other response, you can't, in class D, try to load class C explicitly and then use it implicitly. In the process of loading class D, the JVM can try to load class C and any other class that D depends on, before it even runs one speck of code from class D. Unless, that is, you use class C explicitly, through Reflection. Which is a gross way to use a class. -- John Moeller [email protected] ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/