jc1 and different vm langauges

Andrew Haley aph@redhat.com
Sun Mar 12 10:35:00 GMT 2006


Jakob Praher writes:
 > 
 > Since _JvObjectPrefix is extern Java this means all classes deriving
 > from it are too?
 > If I declare a class, for instance like this:
 > 
 > #include <java/lang/Object.h>
 > 
 > class Foo : public java::lang::Object
 > {
 > virtual int test( );
 > };
 > 
 > test would be automatically be of the Java name mangling?
Java classes are declared in Java, not in C++. 
The correct way to do this is to generate a C++ header using gcjh,
which does the right thing:
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __Foo__
#define __Foo__
#pragma interface
#include <java/lang/Object.h>
#include <gcj/array.h>
extern "Java"
{
 class Foo;
}
class Foo : public ::java::lang::Object
{
public:
 Foo ();
 static void main (JArray< ::java::lang::String *> *);
 static ::java::lang::Class class$;
};
#endif /* __Foo__ */
 > Cause java::lang::Object is too declared outside of extern "Java".
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /