<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">If you are experimenting with generating all symbols before deciding on which --include options to use, then you can workaround the missing static symbols issue (which happens frequently on Windows) by making jextract use one symbol per file:</div><div dir="ltr"><div><br></div><div><div>     set _JAVA_OPTIONS=-Djextract.constants.per.class=0</div></div><div><br></div><div>Obviously the number of source files increases a lot but you won't see "java.lang.UnsatisfiedLinkError: unresolved symbol: xxx" unless you inadvertently use one of the those static import symbols.</div><div><br></div><div>Kind regards</div><div><br></div><div>Duncan Gittins</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 5 Sept 2022 at 12:30, Manuel Bleichenbacher <<a href="mailto:manuel.bleichenbacher@gmail.com">manuel.bleichenbacher@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Is there a reason to treat inline static functions different from function-like macros?</div><div><br></div><div>Inline static functions are never exported. So if code is generated, it will always fail. It would make much more sense to ignore them and not generate code.</div><div><br></div><div>If code is generated, workarounds must be used. In particular, the function and data structures must be explicitly specified. It is no longer possible to use jextract for entire header files if just a single inline static function is present.</div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 5, 2022 at 4:42 AM Sundararajan Athijegannathan <<a href="mailto:sundararajan.athijegannathan@oracle.com" target="_blank">sundararajan.athijegannathan@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Only symbols exported from shared objects/DLLs/dylibs can be called (for eg. marked declspec(dllexport) on Windows, listed in mapfile on Unix platforms and so on). Using platform specific tools such as "nm" (Linux), "otool" (macOS) etc, you can check if that
 symbol is exported from the library.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Also, you need to load that native library using System.load/loadLibrary API before creating native method handles.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hope this helps,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
-Sundar</div>
<div id="m_1801369442960073708gmail-m_6875640488931216251appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_1801369442960073708gmail-m_6875640488931216251divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> jextract-dev <<a href="mailto:jextract-dev-retn@openjdk.org" target="_blank">jextract-dev-retn@openjdk.org</a>> on behalf of dreamlike_ocean lei <<a href="mailto:dreamlike.vertx@gmail.com" target="_blank">dreamlike.vertx@gmail.com</a>><br>
<b>Sent:</b> 04 September 2022 20:00<br>
<b>To:</b> <a href="mailto:jextract-dev@openjdk.org" target="_blank">jextract-dev@openjdk.org</a> <<a href="mailto:jextract-dev@openjdk.org" target="_blank">jextract-dev@openjdk.org</a>><br>
<b>Subject:</b> static inline and jextract</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">English is not my first language<br>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">I used jextract to generate a java-bound version of liburing.h. <br>
</div>
<div>I found an unreasonable situation。 such as:<br>
</div>
<div>`static inline void io_uring_prep_readv`<br>
</div>
<div>
<div><br>
</div>
<div>It is not an exported function,But jextract generates code like this</div>
</div>
<div> public static void io_uring_prep_readv(Addressable var0, int var1, Addressable var2, int var3, long var4)<br>
</div>
<div>when I call ` io_uring_prep_readv` in java, It will throw Exception in thread "main" java.lang.UnsatisfiedLinkError: unresolved symbol: io_uring_prep_readv</div>
<div> Isn't this unreasonable and inconvenient?Shouldn't only exported functions be generated?</div>
<div>————————Chinese version—————————————<br>
</div>
<div>我利用jextract 生成liburing.h的java绑定</div>
<div>但是我发现了一个很奇怪的情况,像`static inline void io_uring_prep_readv`这种函数并不是导出的函数,但是jextract 确实生成了这个的java代码。</div>
<div> public static void io_uring_prep_readv(Addressable var0, int var1, Addressable var2, int var3, long var4)<br>
</div>
<div>当我调用用java去调用io_uring_prep_readv时,它会抛出一个Exception in thread "main" java.lang.UnsatisfiedLinkError: unresolved symbol: io_uring_prep_readv异常</div>
<div>这确实不太合理也不太方便吧,难道不应该只生成导出的函数吗?</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</div></blockquote></div>
</blockquote></div>