A RetroSearch Logo

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

Search Query:

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

FAQ · nativelibs4java/BridJ Wiki · GitHub

BridJ's Frequently Asked Questions

BridJ is a library that lets you call C, C++ and Objective-C libraries from Java as if you were writing native code. It is a recent alternative to JNA.

With the help of JNAerator, it provides clean and unambiguous mappings to C/C++ code and a very straightforward and highly typed API to manipulate pointers, classes, structs, unions...

It bridges Java's gap when it comes to native-world interoperability.

For instance, you can allocate a new float[10] almost as in C++ :

void someFunc(float* values);

float* array = new float[10];
float value = array[4];
someFunc(array);
delete[] array;

Scala code :

import org.bridj.Pointer._
...
@native def someFunc(values: Pointer[Float](./Float)): Unit
...
val array = allocateFloats(10)
val value = array(4)
someFunc(values)

// optional : will be eventually called by the Garbage Collector
array.release 

Java code :

import org.bridj.Pointer;
import static org.bridj.Pointer.*;
...
public static native void someFunc(Pointer<Float> values);
...
Pointer<Float> array = allocateFloats(10);
float value = array.get(4);
someFunc(values);
array.release();

Read more about :

Why another interop library ?

In three words : C++, Performance and Usability

What is BridJ's development status ?

Please read CurrentState

What platforms does BridJ support ?

... with plans for FreeBSD (help and / or test hardward welcome)

BridJ hangs with 100% CPU usage !

If you're on Windows x86 (or on 64 bits windows in a 32 bits JVM), this is typically a case of bad calling convention being used for a native function or callback binding. Please triple-check the calling convention (could it be __stdcall ?) and add a proper @Convention(Convention.Style.xxx) annotation.

How to specify different calling conventions for different platforms ?

Short answer is : you don't need to.

Only Windows x86 has different calling conventions, so @Convention annotations will typically be ignored silently on other platforms.

Can I build BridJ from sources ?

Sure, please read Build.

What is BridJ's license ?

BridJ is dual-licensed under a very liberal BSD license and the very liberal Apache 2.0 license.

Please read HowToHelp.

What are BridJ's runtime dependencies ?

BridJ is released as a self-contained JAR.

However, it includes a copy of the [ASM] library and its native library are statically linked with a modified version of https://dyncall.org Dyncall.

More details here : CreditsAndLicense.

How do I bind C / C++ function / struct / class / type XXX with BridJ ?

Just paste your C header into JNAerator, choose BridJ as runtime and click on JNAerate.

Where can I get support for BridJ ?

On NativeLibs4Java's mailing-list.

How is BridJ different from...

Things BridJ aims at doing better than JNA :

import static org.bridj.Pointer.*;
...
Pointer<Integer> p = pointerToInts(1, 2, 3, 4);
p.set(0, 10);
for (int v : p)
  System.out.println("Next value : " + v);

Where JNA wins over BridJ :

BridJ's advantages :

SWIG's advantages:

Please let us know if you want your project to be listed here :-)


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