diff options
Diffstat (limited to 'doc/GlueGen_Mapping.html')
-rw-r--r-- | doc/GlueGen_Mapping.html | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/doc/GlueGen_Mapping.html b/doc/GlueGen_Mapping.html index dd63718..96c56c5 100644 --- a/doc/GlueGen_Mapping.html +++ b/doc/GlueGen_Mapping.html @@ -1809,11 +1809,37 @@ StructPackage T2_InitializeOptions com.jogamp.gluegen.test.junit.generation</cod Native C-API Support</h3> <p>GlueGen supports registering Java callback methods to native C-API functions in the form:</p> -<pre><code>typedef int32_t ( * T_CallbackFunc)(size_t id, size_t msg_len, const char* msg, void* userParam); +<pre><code>typedef int32_t ( * T_CallbackFunc)(size_t id, const char* msg, void* userParam); void AddMessageCallback(T_CallbackFunc func, void* userParam); void RemoveMessageCallback(T_CallbackFunc func, void* userParam); -void InjectMessageCallback(size_t id, size_t msg_len, const char* msg);</code></pre> +void InjectMessageCallback(size_t id, const char* msg);</code></pre> +<p>and the following GlueGen configuration</p> +<pre><code>ArgumentIsString T2_CallbackFunc 1 +ArgumentIsString InjectMessageCallback 1 + +# Define a JavaCallback, enacted on a function-pointer argument `T2_CallbackFunc` and a user-param `void*` for Java Object mapping +JavaCallbackDef T2_CallbackFunc 2</code></pre> +<p>This will lead to the following result</p> +<pre><code>public interface Bindingtest2 { + + /** JavaCallback interface: T2_CallbackFunc -> int32_t (*T2_CallbackFunc)(size_t id, const char * msg, void * userParam) */ + public static interface T2_CallbackFunc { + /** Interface to C language function: <br> <code>int32_t callback(size_t id, const char * msg, void * userParam)</code><br>Alias for: <code>T2_CallbackFunc</code> */ + public int callback(long id, String msg, Object userParam); + } + + ... + + /** Entry point (through function pointer) to C language function: <br> <code>void AddMessageCallback(int32_t (*func)(size_t id, const char * msg, void * userParam), void * userParam)</code><br> */ + public void AddMessageCallback(T2_CallbackFunc func, Object userParam); + + /** Entry point (through function pointer) to C language function: <br> <code>void RemoveMessageCallback(int32_t (*func)(size_t id, const char * msg, void * userParam), void * userParam)</code><br> */ + public void RemoveMessageCallback(T2_CallbackFunc func, Object userParam); + + /** Entry point (through function pointer) to C language function: <br> <code>void InjectMessageCallback(size_t id, const char * msg)</code><br> */ + public void InjectMessageCallback(long id, String msg); +</code></pre> <p><em>TODO: Work in progress</em></p> <h4 id="example-1">Example</h4> <h2 id="platform-header-files">Platform Header Files</h2> |