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: jc1 and different vm langauges


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.


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