org.bridj
Class Callback<C extends Callback<C>>
java.lang.Object
org.bridj.NativeObject
org.bridj.Callback<C>
- All Implemented Interfaces:
- CallbackInterface, NativeObjectInterface
- Direct Known Subclasses:
- CPPRuntime.CPPDestructor, DynamicFunction, JAWT_DrawingSurface.FreeDrawingSurfaceInfo_callback, JAWT_DrawingSurface.GetDrawingSurfaceInfo_callback, JAWT_DrawingSurface.Lock_callback, JAWT_DrawingSurface.Unlock_callback, JAWT.FreeDrawingSurface_callback, JAWT.GetComponent_callback, JAWT.GetDrawingSurface_callback, JAWT.Lock_callback, JAWT.Unlock_callback
public abstract class Callback<C extends Callback<C>>
- extends NativeObject
- implements CallbackInterface
Native C callback (beware : don't let your callbacks be GC'd before they're used).
To protect a callback against the GC, you can keep a reference to your callback or use BridJ.protectFromGC(org.bridj.NativeObject)
/ BridJ.unprotectFromGC(org.bridj.NativeObject)
.
A callback is a Java object with only one abstract method exposed as a C function pointer to the native world.
Here's an example of callback definition (use JNAerator to generate them automatically) :
// typedef int (*MyCallback)(int a, int b);
public static abstract class MyCallback extends Callback {
public abstract int doSomething(int a, int b);
}
- Author:
- Olivier Chafik
Callback
public Callback()
toPointer
public Pointer<C> toPointer()
Copyright © 2009-2012. All Rights Reserved.