aboutsummaryrefslogtreecommitdiffstats
path: root/doc/GlueGen_Mapping.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/GlueGen_Mapping.html')
-rw-r--r--doc/GlueGen_Mapping.html30
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 -&gt; int32_t (*T2_CallbackFunc)(size_t id, const char * msg, void * userParam) */
+ public static interface T2_CallbackFunc {
+ /** Interface to C language function: &lt;br&gt; &lt;code&gt;int32_t callback(size_t id, const char * msg, void * userParam)&lt;/code&gt;&lt;br&gt;Alias for: &lt;code&gt;T2_CallbackFunc&lt;/code&gt; */
+ public int callback(long id, String msg, Object userParam);
+ }
+
+ ...
+
+ /** Entry point (through function pointer) to C language function: &lt;br&gt; &lt;code&gt;void AddMessageCallback(int32_t (*func)(size_t id, const char * msg, void * userParam), void * userParam)&lt;/code&gt;&lt;br&gt; */
+ public void AddMessageCallback(T2_CallbackFunc func, Object userParam);
+
+ /** Entry point (through function pointer) to C language function: &lt;br&gt; &lt;code&gt;void RemoveMessageCallback(int32_t (*func)(size_t id, const char * msg, void * userParam), void * userParam)&lt;/code&gt;&lt;br&gt; */
+ public void RemoveMessageCallback(T2_CallbackFunc func, Object userParam);
+
+ /** Entry point (through function pointer) to C language function: &lt;br&gt; &lt;code&gt;void InjectMessageCallback(size_t id, const char * msg)&lt;/code&gt;&lt;br&gt; */
+ 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>