A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nativelibs4java/BridJ/wiki/CPlusPlus below:

CPlusPlus · nativelibs4java/BridJ Wiki · GitHub

Also read CurrentState and TypeMapping for more details.

Let's use the following C++ class throughout this page :

#ifndef TEST_EXPORT
#define TEST_EXPORT
#endif
class TEST_EXPORT TestClass {
public:
    virtual ~TestClass();
    virtual int testVirtualAdd(int a, int b);
};

Its BridJ bindings are easy to write, but it is advised to use JNAerator to create them, nevertheless :

import org.bridj.*;
import static org.bridj.Pointer.*;

public static class TestClass extends CPPObject {
	@Virtual(0) 
	public native int testVirtualAdd(int a, int b);
};

All of BridJ's supported platforms (see CurrentState).

TestClass test = new TestClass();
Pointer<TestClass> pTest = pointerTo(test);
int result = test.testVirtualAdd(1, 2);
TestClass test = new TestClass() {
	@Override
	public int testVirtualAdd(int a, int b) {
		return a + b;
	}
};

The only known limitation so far is that you cannot call super.testVirtualAdd from the overridden method yet (but this is worked on and should be possible in the next release).


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4