<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>The function is also 'static'. Static functions are typically not
      exported from the runtime library, so we can not link against them
      dynamically (which is required for a function to be callable from
      Java). You might want to confirm by running e.g. `nm <runtime
      library>` that this function is actually an exported symbol in
      the library.</p>
    <p>Alternatively, you might be able to re-write this function in
      Java using the parts of the library that are exported/dynamically
      link-able.<br>
    </p>
    <p>Jorn<br>
    </p>
    <div class="moz-cite-prefix">On 22/04/2024 01:36, Thiago Milczarek
      Sayão wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAAP_wun=ankpL4LW=b7R-unFQuq_6FyKd3qnd3KAtE1d-jrduQ@mail.gmail.com">
      
      <div dir="ltr">
        <div dir="ltr">Humm, 
          <div><br>
          </div>
          <div>It an inline function:<br>
            <div><br>
            </div>
            <div>
              <div style="background-color:rgb(30,31,34);color:rgb(188,190,196)">
                <pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(207,142,109)">static </span><span style="color:rgb(199,125,187)">inline </span><span style="color:rgb(207,142,109)">struct </span>wl_registry *
wl_display_get_registry(<span style="color:rgb(207,142,109)">struct </span>wl_display *wl_display)
{
        <span style="color:rgb(207,142,109)">struct </span>wl_proxy *registry;

        registry = wl_proxy_marshal_flags((<span style="color:rgb(207,142,109)">struct </span>wl_proxy *) wl_display,
                         WL_DISPLAY_GET_REGISTRY, &wl_registry_interface, wl_proxy_get_version((<span style="color:rgb(207,142,109)">struct </span>wl_proxy *) wl_display), <span style="color:rgb(42,172,184)">0</span>, NULL);

        <span style="color:rgb(207,142,109)">return </span>(<span style="color:rgb(207,142,109)">struct </span>wl_registry *) registry;
}
</pre>
              </div>
            </div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">Em dom., 21 de abr. de 2024
            às 20:25, Jorn Vernee <<a href="mailto:jorn.vernee@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">jorn.vernee@oracle.com</a>>
            escreveu:<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>
              <p>A pointer type is always supported, so it should not
                prevent a function that uses such a type from being
                generated.</p>
              <p>Are you seeing any warnings about
                `wl_display_get_registry` being skipped because of an
                unsupported type?</p>
              <p>Could you shared the header file declaration of
                wl_display_get_registry?<br>
              </p>
              <p>Jorn<br>
              </p>
              <div>On 22/04/2024 00:51, Thiago Milczarek Sayão wrote:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">Hello Jorn,
                  <div><br>
                  </div>
                  <div>Thanks for replying.</div>
                  <div><br>
                  </div>
                  <div>I think it's by design - those fields of
                    wl_registry are private and only accessible through
                    wl_registry functions;<br>
                  </div>
                  <div><br>
                  </div>
                  <div>The problem is that it does not generate the
                    functions that uses it, for
                    example wl_display_get_registry<br>
                  </div>
                  <div><br>
                  </div>
                  <div>I did:</div>
                  <div>
                    <div style="background-color:rgb(30,31,34);color:rgb(188,190,196)">
                      <pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(197,118,51)">jextract </span>--output src/main/java -t org.freedesktop.wayland.client \
  --header-class-name WlClientProto <span style="color:rgb(197,118,51)">`pkg-config </span>--cflags-only-I wayland-client<span style="color:rgb(197,118,51)">`</span> \
  <span style="color:rgb(197,118,51)">`pkg-config </span>--libs wayland-client<span style="color:rgb(197,118,51)">`</span>  \
  /usr/include/wayland-client-protocol.h</pre>
                    </div>
                  </div>
                  <div><br>
                  </div>
                  <div>The clarified message looks good.</div>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">Em dom., 21 de abr.
                    de 2024 às 18:30, Jorn Vernee <<a href="mailto:jorn.vernee@oracle.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">jorn.vernee@oracle.com</a>>
                    escreveu:<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>
                      <p>Hello Thiago,</p>
                      <p>It looks like the library you are using uses
                        opaque types. Or, in other words, a type that is
                        declared but not defined, such as:</p>
                      <p>    <font face="monospace">struct Foo;</font></p>
                      <p>These types are not supported by jextract in
                        the sense that the header file does not contain
                        any definition for these types, so jextract also
                        can't generate any code to access the fields of
                        such a struct. This is not a current limitation
                        of jextract, but a limitation imposed by the
                        wayland library.<br>
                      </p>
                      <p>This is known as the 'opaque pointer idiom'
                        [1]. It is a way of encapsulating the internals
                        of a type, while still allowing a client to use
                        it. It looks like the wayland library uses types
                        like these in a lot of places. It doesn't mean
                        that the library is unusable, it just means that
                        the contents of these structs is not exposed by
                        the library (and therefore <i>cannot</i> be
                        exposed by jextract). i.e. this is by design.
                        You should still be able to use the library
                        through the generated bindings.<br>
                      </p>
                      <p>I think for clarity we could perhaps change the
                        warning message that jextract prints to
                        something like:    </p>
                      <p><font face="monospace">    WARNING: Skipping
                          wl_registry (type Declared(wl_registry) is
                          declared but not defined)</font></p>
                      <p>HTH,<br>
                        Jorn<br>
                      </p>
                      <p>[1]: <a href="https://urldefense.com/v3/__https://en.wikipedia.org/wiki/Opaque_pointer__;!!ACWV5N9M2RV99hQ!J7UcZ_pVCMYJLfWJp9TZNELYAFrerMmP-yIjI1X6pBl6Zfx8gKLGiEb8ESgd_FTELrMqKd0F8pBF_Zs6zquT91c$" target="_blank" moz-do-not-send="true">https://en.wikipedia.org/wiki/Opaque_pointer</a></p>
                      <div>On 21/04/2024 18:58, Thiago Milczarek Sayão
                        wrote:<br>
                      </div>
                      <blockquote type="cite">
                        <div dir="ltr">Hi,
                          <div><br>
                          </div>
                          <div>I'm trying to make a java wayland client
                            (currently as a proof of concept).</div>
                          <div><br>
                          </div>
                          <div>I've attempted to generate the bindings
                            like this:</div>
                          <div><br>
                          </div>
                          <div>jextract --output src -t
                            org.freedesktop.wayland.client
                            --header-class-name WlClient
                            -lwayland-client
                             /usr/include/wayland-client.h</div>
                          <div><br>
                          </div>
                          <div>But the wl_xxx types seem to not be
                            supported as it outputs:</div>
                          <div><br>
                          </div>
                          <div>WARNING: Skipping wl_registry (type
                            Declared(wl_registry) is not supported)<br>
                          </div>
                          <div><br>
                          </div>
                          <div>I've probably hit a current limitation.
                            Is it expected to work in the future?</div>
                          <div><br>
                          </div>
                          <div>Thanks.</div>
                          <div>-- Thiago.</div>
                        </div>
                      </blockquote>
                    </div>
                  </blockquote>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>