Integration with C

Andrew Haley aph@redhat.com
Tue Apr 22 15:44:00 GMT 2003


gbevin@uwyn.com writes:
 > Hmm just thought of something else. What you suggest is a function, not 
 > a class method. So it only calls the class with a static method, it 
 > doesn't access a method of a class instance. Is it possible to add a 
 > method like this to the class's api, or do I have to provide the class 
 > instance to a similar function if I don't want to work with static 
 > methods for this?

It's not possible to define a Java method that isn't declared in the
corresponding java .class file.  As a consequence of that, every
argument to that method must be well-defined from a Java point of
view.  So, you can't have a native method that takes a void*, for
example.  However, you can define a C++ wrapper class with a data
member which refers to the Java class.

Andrew.



More information about the Java mailing list