org.bridj
Class Callback<C extends Callback<C>>

java.lang.Object
  extended by org.bridj.NativeObject
      extended by 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

Constructor Summary
Callback()
           
 
Method Summary
 Pointer<C> toPointer()
           
 
Methods inherited from class org.bridj.NativeObject
clone, equals
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Callback

public Callback()
Method Detail

toPointer

public Pointer<C> toPointer()


Copyright © 2009-2013. All Rights Reserved.