This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: newbie question: need help linking


Prabhakar, Vijay (IT) writes:
 > Hmm, what about a native method that's written as part of a Java class
 > that's compiled with gcj.  Can that be called from a .class file?

Yes.  You make it into a shared library.  See 

Extra features unique to gcj

   * When you compile your classes into a shared library they can be
     automatically loaded by the `libgcj' system classloader.  When
     trying to load a class `gnu.pkg.SomeClass' the system classloader
     will first try to load the shared library
     `lib-gnu-pkg-SomeClass.so', if that fails to load the class then
     it will try to load `lib-gnu-pkg.so' and finally when the class is
     still not loaded it will try to load `lib-gnu.so'.  Note that all
     `.'s will be transformed into `-'s and that searching for inner
     classes starts with their outermost outer class.  If the class
     cannot be found this way the system classloader tries to use the
     `libgcj' bytecode interpreter to load the class from the standard
     classpath.  This process can be controlled to some degree via the
     `gnu.gcj.runtime.VMClassLoader.library_control' property; see *Note
     libgcj Runtime Properties::.

 > I was thinking about writing a class for wrapping and unwrapping
 > primitives when communicating between C++ and Java.  In other
 > words, I was hoping to have a class converts RawData objects which
 > are actually arrays (or vectors/other STL datastructures) of C++
 > primitives and returns arrays of Java primitives.  Would I be
 > better off writing a C++ template that converts C++ primitives into
 > j<primitive> arrays so that it can communicate with the Java code?

I have no idea.  Depends on your application.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]