{"id":1309,"date":"2023-08-14T11:18:48","date_gmt":"2023-08-14T15:18:48","guid":{"rendered":"https:\/\/jausoft.com\/blog\/?p=1309"},"modified":"2023-08-14T11:29:39","modified_gmt":"2023-08-14T15:29:39","slug":"gluegen-compiler-updates","status":"publish","type":"post","link":"https:\/\/jausoft.com\/blog\/2023\/08\/14\/gluegen-compiler-updates\/","title":{"rendered":"GlueGen Compiler Updates"},"content":{"rendered":"<p><a href=\"https:\/\/jogamp.org\/gluegen\/www\/\">GlueGen<\/a> is a compiler for function and data-structure declarations, generating Java\u2122 and JNI C code offline at compile time and allows using native libraries within your Java\u2122 application. GlueGen is used for the <a href=\"https:\/\/jogamp.org\">JogAmp<\/a> projects <a href=\"https:\/\/jogamp.org\/joal\/www\/\">JOAL<\/a>, <a href=\"https:\/\/jogamp.org\/jogl\/www\/\">JOGL<\/a> and <a href=\"https:\/\/jogamp.org\/jocl\/www\/\">JOCL<\/a> besides others. We have added <strong>Java\u2122 callbacks<\/strong>, enhanced <strong>compound struct access<\/strong>, bumped the <strong>Java\u2122 source language level<\/strong> and updated the <strong>documentation<\/strong>.<!--more--><\/p>\n<p>You may also like to read <a href=\"https:\/\/forum.jogamp.org\/GlueGen-Proudly-Beating-Panama-td4042711.html\">GlueGen Proudly Beating Panama<\/a> and <a href=\"https:\/\/forum.jogamp.org\/GlueGen-JNI-versus-Panama-td4042047.html\">GlueGen\/JNI versus Panama<\/a>, where I recap GlueGen&#8217;s features and compare it against OpenJDK project Panama. Bottom line, GlueGen&#8217;s ability to produce data-struct and foreign function (FFI) bindings statically at compile time allows an easy to use resulting Java API and code analysis plus security assessments.<\/p>\n<p>I like to thank Mathieu F\u00e9ry and the team at Ankama for joining efforts in these tasks.<\/p>\n<p>The work will be released within <a href=\"https:\/\/jogamp.org\/wiki\/index.php?title=SW_Tracking_Report_Objectives_for_the_release_2.5.0\">JogAmp v2.5.0<\/a> and <a href=\"https:\/\/forum.jogamp.org\/Release-2-5-0-td4042507.html\">release candidates are available<\/a>.<\/p>\n<p>Below I have <strong>emphasized<\/strong> the new and updated <a href=\"https:\/\/jogamp.org\/gluegen\/www\/\">GlueGen<\/a> parts, besides, the following documentation has been updated or newly added:<\/p>\n<ul>\n<li><a href=\"https:\/\/jogamp.org\/gluegen\/doc\/GlueGen_Mapping.html\">GlueGen Native Data &amp; Function Mapping<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/gluegen\/doc\/manual\/\">GlueGen Manual<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/gluegen\/doc\/JogAmpMacOSVersions.html\">JogAmp&#8217;s MacOS Version Support<\/a><\/li>\n<\/ul>\n<p style=\"text-align: center;\">***<\/p>\n<p><a href=\"https:\/\/jogamp.org\/gluegen\/www\/\">GlueGen<\/a>&#8216;s compiler reads ANSI C header files and separate configuration files which provide control over many aspects of the glue code generation. GlueGen uses a complete ANSI C parser and an internal representation (IR) capable of representing all C types to represent the APIs for which it generates interfaces. It has the ability to perform significant transformations on the IR before glue code emission.<\/p>\n<p>GlueGen can produce native foreign function bindings to Java\u2122 as well as <strong><a href=\"https:\/\/jogamp.org\/gluegen\/doc\/GlueGen_Mapping.html#struct-mapping\">map native data structures<\/a><\/strong> to be fully accessible from Java\u2122 including potential calls to <a href=\"https:\/\/jogamp.org\/gluegen\/doc\/GlueGen_Mapping.html#struct-function-pointer-support\">embedded function pointer<\/a>.<\/p>\n<p>GlueGen supports <strong><a href=\"https:\/\/jogamp.org\/gluegen\/doc\/GlueGen_Mapping.html#java-callback\">registering Java\u2122 callback methods<\/a><\/strong> to receive asynchronous and off-thread native toolkit events, where a generated native callback function dispatches the events to Java\u2122.<\/p>\n<p>GlueGen also supports <a href=\"https:\/\/jogamp.org\/gluegen\/doc\/GlueGen_Mapping.html#oo-style-api-interface-mapping\">producing an OO-Style API mapping<\/a> like <a href=\"https:\/\/jogamp.org\/jogl\/doc\/uml\/html\/index.html\">JOGL&#8217;s incremental OpenGL Profile API levels<\/a>.<\/p>\n<p>GlueGen is capable to bind low-level APIs such as the Java\u2122 Native Interface (JNI) and the AWT Native Interface (JAWT) back up to the Java programming language.<\/p>\n<p>Further, GlueGen supports <strong><a href=\"https:\/\/jogamp.org\/gluegen\/doc\/GlueGen_Mapping.html#libraryonload-librarybasename-for-jni_onload-\">generating `JNI_OnLoad*(..)` for dynamic and static libraries<\/a><\/strong>, also resolving off-thread `JNIEnv*` lookup.<\/p>\n<p>GlueGen utilizes <strong><a href=\"https:\/\/jogamp.org\/cgit\/jcpp.git\/about\/\">JCPP<\/a><\/strong>, migrated C preprocessor written in Java\u2122.<\/p>\n<p style=\"text-align: center;\">***<\/p>\n<p>Related bug\/feature reports are<\/p>\n<ul>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1435\">Bug 1435: JavaCallback<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1434\">Bug 1434: Struct Mapping<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1442\">Bug 1442: Parse Java inner classes &amp; interfaces<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1443\">Bug 1443: Parse Java annotations<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1448\">Bug 1448: Update JCPP to upstream v1.4.14<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1449\">Bug 1449: Update GlueGen Documentation<\/a><\/li>\n<li><a href=\"https:\/\/jogamp.org\/bugzilla\/\/show_bug.cgi?id=1450\">Bug 1450: Fix C parser constant-expressions<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>GlueGen is a compiler for function and data-structure declarations, generating Java\u2122 and JNI C code offline at compile time and allows using native libraries within your Java\u2122 application. GlueGen is used for the JogAmp projects JOAL, JOGL and JOCL besides others. We have added Java\u2122 callbacks, enhanced compound struct access, bumped the Java\u2122 source language&hellip; <a class=\"more-link\" href=\"https:\/\/jausoft.com\/blog\/2023\/08\/14\/gluegen-compiler-updates\/\">Continue reading <span class=\"screen-reader-text\">GlueGen Compiler Updates<\/span> <span class=\"meta-nav\" aria-hidden=\"true\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7,3,8,58],"tags":[9,51,76,13,16,44,46,25],"class_list":["post-1309","post","type-post","status-publish","format-standard","hentry","category-3d-opengl","category-computer-stuff","category-jogamp","category-computer-languages","tag-3d","tag-c","tag-compiler","tag-embedded-device","tag-java","tag-jogamp","tag-openjdk","tag-security"],"_links":{"self":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts\/1309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/comments?post=1309"}],"version-history":[{"count":6,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts\/1309\/revisions"}],"predecessor-version":[{"id":1315,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts\/1309\/revisions\/1315"}],"wp:attachment":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/media?parent=1309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/categories?post=1309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/tags?post=1309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}