<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">
Hi,</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">
Thanks for reporting this issue. I've filed a bug:</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://bugs.openjdk.org/browse/CODETOOLS-7903237" id="LPlnk397442">https://bugs.openjdk.org/browse/CODETOOLS-7903237</a><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">
Thanks</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
-Sundar</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 Maurizio Cimadamore <maurizio.cimadamore@oracle.com><br>
<b>Sent:</b> 18 July 2022 14:58<br>
<b>To:</b> Lost Illusion <im@lostillusion.net>; jextract-dev@openjdk.org <jextract-dev@openjdk.org><br>
<b>Subject:</b> Re: BUG: function pointer as struct member does not compile if name is same as the struct</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi,<br>
I can reproduce even with explicit struct name:<br>
<br>
```<br>
struct Foo {<br>
     int (*Foo)();<br>
};<br>
```<br>
<br>
I'll leave this to Sundar - my feeling is that the code in Output helper <br>
that handles function pointers does not check for clashes with the <br>
surrounding scope; we perform such checks when nesting structs inside <br>
other structs, but apparently the name clash logic is missing for <br>
function pointers.<br>
<br>
Maurizio<br>
<br>
On 17/07/2022 04:28, Lost Illusion wrote:<br>
> Hello,<br>
> I'm currently using jextract in tandem with Kotlin/Native's ability to<br>
> generate shared libraries and header files. It works nicely until you<br>
> add a class to the Kotlin code which generates a struct and a function<br>
> pointer (the initializer for the class) as a struct member, with both<br>
> having the same name. Here's a minimal header file with the same<br>
> problem.<br>
> test.h:<br>
> ```<br>
> struct {<br>
>      int (*Foo)();<br>
> } Foo;<br>
> ```<br>
> While this is valid for a header file, jextract has a problem<br>
> processing it. Using the latest jextract on the jdk18 branch, and<br>
> using the following command: `jextract test.h`. I get bombarded with<br>
> 11 errors about resolving symbols and a duplicate class. Seems to be<br>
> because a static class for the struct Foo is generated and an<br>
> interface for the method Foo is also generated. I'm new to the project<br>
> and not sure what the correct behavior should be in order to fix this<br>
> issue.<br>
</div>
</span></font></div>
</body>
</html>