Hi, I want to expose my C++ pure virtual classes with Java interfaces. To do so, I've already tried some solution around the directors feature. Unfortunately, some use cases can't be solved with this solution. >From the following C++ code:

class Foo {
public:
virtual ~Foo(){}
void bar() = 0;
};

class Zorg {
public:
void work(Foo* foo);
;
I wish I can have the following Java code:

interface IFoo {
void bar();
}

class Zorg {
  void work(IFoo foo) {
    // not MyModule.work(Foo.getCPtr(foo), foo));
   // I do not control the implementations of IFoo
    MyOwnNatives.work(foo);
  }
}
And then write manually MyOwnNatives

void Java_org_acme_MyOwnNatives_work(jobject jfoo) {
Foo* foo = MyFooImpl(jfoo);
}
The director feature do the proxy job in Java, here, I do it in C++. It's simpler when dealing with Java interfaces prototype and implementation of these interfaces done by end user. The GC handling is a pain to handle between Java side, JNI side and C++ side. Is there any way to do so? Or an alternative solution?

View this message in context: Write my own Java implementation of a method
Sent from the swig-user mailing list archive at Nabble.com.