<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Yes, "static inline" is part of C99</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<a href="https://en.wikipedia.org/wiki/Inline_function" id="LPlnkOWALinkPreview">https://en.wikipedia.org/wiki/Inline_function</a><br>
</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1">
<div id="LPBorder_GTaHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvSW5saW5lX2Z1bmN0aW9u" class="LPBorder162964" style="width: 100%; margin-top: 16px; margin-bottom: 16px; position: relative; max-width: 800px; min-width: 424px;">
<table id="LPContainer162964" role="presentation" style="padding: 12px 36px 12px 12px; width: 100%; border: 1px solid rgb(200, 200, 200); border-radius: 2px;">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td style="width: 100%;">
<div id="LPTitle162964" style="font-size: 21px; font-weight: 300; margin-right: 8px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; margin-bottom: 12px;">
<a target="_blank" id="LPUrlAnchor162964" href="https://en.wikipedia.org/wiki/Inline_function" style="text-decoration: none; color: var(--themePrimary);">Inline function - Wikipedia</a></div>
<div id="LPDescription162964" style="font-size: 14px; max-height: 100px; color: rgb(102, 102, 102); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; margin-bottom: 12px; margin-right: 8px; overflow: hidden;">
In the C and C++ programming languages, an inline function is one qualified with the keyword inline; this serves two purposes: . It serves as a compiler directive that suggests (but does not require) that the compiler substitute the body of the function inline
by performing inline expansion, i.e. by inserting the function code at the address of each function call, thereby saving the overhead ...</div>
<div id="LPMetadata162964" style="font-size: 14px; font-weight: 400; color: rgb(166, 166, 166); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;">
en.wikipedia.org</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">PS. perhaps static inline stuff should be auto-filtered by jextract - given that these symbols cannot be exported from shared objects anyway?</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
-Sundar</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> jextract-dev <jextract-dev-retn@openjdk.org> on behalf of Manuel Bleichenbacher <manuel.bleichenbacher@gmail.com><br>
<b>Sent:</b> 05 September 2022 21:02<br>
<b>To:</b> Maurizio Cimadamore <maurizio.cimadamore@oracle.com><br>
<b>Cc:</b> jextract-dev@openjdk.org <jextract-dev@openjdk.org><br>
<b>Subject:</b> Re: static inline and jextract</font>
<div> </div>
</div>
<div>
<div dir="ltr">Talking of things to skip:
<div><br>
</div>
<div>Windows constants like "GUID_DEVINTERFACE_USB_DEVICE" should also be skipped. Through two layers of macros, it resolves to:</div>
<div><br>
</div>
<div>extern "C" const GUID __declspec(selectany) GUID_DEVINTERFACE_USB_DEVICE</div>
<div> = { 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } };<br>
</div>
<div><br>
</div>
<div>Can you spot the problem? It's a definition, and not a declaration. So there can't possibly be a symbol for it in an external library.</div>
<div><br>
</div>
<div>At the moment, jextract will generate code, which then fails with "unresolved symbol: GUID_DEVINTERFACE_USB_DEVICE". It clearly should be skipped.<br>
</div>
<div><br>
</div>
<div>To reproduce it:</div>
<div><br>
</div>
<div>windows_headers.h:</div>
<div>#include <windows.h><br>
#include <initguid.h><br>
#include <usbiodef.h><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>set SDK_DIR=C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0<br>
jextract --source ^<br>
-D _AMD64_ -D _M_AMD64=100 -D UNICODE -D _UNICODE ^<br>
-I "%SDK_DIR%\um" ^<br>
-I "%SDK_DIR%\shared" ^<br>
--include-var GUID_DEVINTERFACE_USB_DEVICE ^<br>
windows_headers.h<br>
</div>
<div><br>
</div>
<div>BTW: "static inline" is a somewhat newer addition to C but it's plain C, isn't?</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Mon, Sep 5, 2022 at 5:10 PM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@oracle.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<br>
On 05/09/2022 12:30, Manuel Bleichenbacher wrote:<br>
> Is there a reason to treat inline static functions different from <br>
> function-like macros?<br>
<br>
IMHO they should be treated similarly - e.g. they should be skipped.<br>
<br>
Also, I thought jextract skipped stuff that was not plain C, so I'm <br>
surprised to see symbols being generated for "inline" functions. Maybe <br>
we're missing some checks?<br>
<br>
Maurizio<br>
<br>
</blockquote>
</div>
</div>
</body>
</html>