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]

GCJ/C++ name mangling incompatibility


In the following test case, where we want to pass an inner class
reference to a native function, GCJ and C++ will produce conflicting
name manglings. They seem to have different interpretations of the "$"
character!

$ nm ./Test.o | grep foo
00000000 r _Utf1foo
         U _ZN4Test3fooEPN13Test__U24_BarE

$ nm ./natTest.o | grep foo
00000000 T _ZN4Test3fooEP8Test$Bar


// Test.java
public class Test
{
  class Bar {}
  native void foo(Bar b);

  void a()
  {
    foo(new Bar());
  }
}

// natTest.cc
#include <Test.h>
#include <Test$Bar.h>
#include <gcj/cni.h>

void
Test::foo (Test$Bar *)
{
}

regards

  [ bryce ]



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