<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 16, 2014 at 2:27 PM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm moving this conversation to where it belongs.<br>
<br>
On Wed, 16 Apr 2014 11:25:26 +0000<br>
<a href="mailto:bugzilla-daemon@freedesktop.org">bugzilla-daemon@freedesktop.org</a> wrote:<br>
<br>
> <a href="https://bugs.freedesktop.org/show_bug.cgi?id=77521" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=77521</a><br>
><br>
>           Priority: medium<br>
>             Bug ID: 77521<br>
>           Assignee: <a href="mailto:wayland-bugs@lists.freedesktop.org">wayland-bugs@lists.freedesktop.org</a><br>
>            Summary: cannot create opengl by dynamically loading wayland<br>
>                     symbols from library<br>
>           Severity: blocker<br>
>     Classification: Unclassified<br>
>                 OS: All<br>
>           Reporter: <a href="mailto:pulkitnandan@gmail.com">pulkitnandan@gmail.com</a><br>
>           Hardware: All<br>
>             Status: NEW<br>
>            Version: 1.3.0<br>
>          Component: wayland<br>
>            Product: Wayland<br>
><br>
> I was trying to implement a window system agnostic library which will be used<br>
> in creating opengl apps with different windows systems. Lets name that library<br>
> as WSAL.Now to achieve this WSAL implements window system interfaces which is<br>
> used in creating native windows etc of specific window system while egl calls<br>
> are in main WSAL library.Consider wayland and X as examples of such two<br>
> libraries. As I separate several implementations of wayland and and X from<br>
> different team members.So to test them efficiently I have to create several<br>
> function pointers and object pointers that are present in those library<br>
> implementations and load them with symbols from libraries using dlsym utility<br>
> so that at compile time I donot have to link with any library.<br>
><br>
> For X I was successfully in creating X backend.<br>
> For wayland I first got stuck at functions which are inline in<br>
> wayland_client_protocol.h. For them I cannot do the same.Instead I created a<br>
> function pointer which these functions actually calls in inline definition.<br>
><br>
> Like when wl_display_get_registry is called wl_proxy_marshal_constructor is<br>
> ultimately called.<br>
><br>
> The terrible fucntions are wl_proxy_marshal_constructor and wl_proxy_marshal as<br>
> they are defined with variable arguments.So I declared<br>
> new_wl_proxy_marshal_constructor a function pointer of same type as<br>
> wl_proxy_marshal_constructor and loaded the symbol from library using dlsym<br>
> into new_wl_proxy_marshal_constructor.<br>
><br>
> But faced a fundamental problem of determing argument types as these terrible<br>
> functions (TFs) don't have constant argument signature i.e it may sometime pass<br>
> a int as its 4th aguments in one inline expansion while a char * in some other<br>
> inline function.<br>
<br>
Why do you need to know the arguments?<br>
Why cannot you just use it as is, with variable arguments?<br>
<br>
Btw. if the generated inline wrapper functions do not suit you, I<br>
think you could generate your own from the XML files, that end up<br>
calling the real functions exported from libwayland-client. That is<br>
how bindings to other programming languages are supposed work to my<br>
understanding.<br></blockquote><div><br></div><div>This won't work with EGL, as EGL expects libwayland-client. It's the same issue with X11: you can't just use XCB because GLX expects Xlib's Display / Window pointers.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> So I explored this wl_proxy_marshal_constructor which actually calls<br>
> wl_proxy_marshal_array_constructor after forming a variable arguments to a<br>
> single argument using some wl_proxy object signature which I have no access to<br>
> in main wayland interface.<br>
><br>
> dlsym option of using rtld_now doesnot work.<br>
><br>
> How to implement such functionality in wayland or provide a way to create a app<br>
> with no linking at build time.<br>
<br>
Have you looked at SDL2?<br>
<a href="http://hg.libsdl.org/SDL/file/tip/src/video/wayland" target="_blank">http://hg.libsdl.org/SDL/file/tip/src/video/wayland</a><br>
<br>
To me it seems like it uses dlopen and dlsym equivalents to load<br>
Wayland libraries. I don't know if it is complete or in use yet,<br>
there seems to be also a non-dlopen path.<br>
<br>
<br>
Thanks,<br>
pq<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>  Jasper<br>
</div></div>