[PATCH wayland] server: use void* instead of function pointer for wl_object.implementation

Jason Ekstrand jason at jlekstrand.net
Thu Mar 28 07:03:33 PDT 2013


Looks good to me. Ship it!  This was part of some of my defunct dispatcher
patches at one point.  I think this is a lot cleaner than casting all the
time anyway.
--Jason
On Mar 28, 2013 8:58 AM, "Giulio Camuffo" <giuliocamuffo at gmail.com> wrote:

> This is needed to make C++ programs that include wayland-server.h build:
> C++ does not allow conversions from data pointers to function pointers.
> ---
> This is the cleanest solution, imho. But if there are problems related to
> Wayland internals, or libffi, or something else, there are two other
> options:
> use a union { void *obj; void (* const *func)(); }; in wl_resource_init()
> in wayland-server.h to convert between the two (really ugly imho) or
> uninline wl_resource_init() and put the implementation somewhere the c++
> compiler doesn't see.
>
>  src/wayland-util.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/wayland-util.h b/src/wayland-util.h
> index 257a5d1..4728aaa 100644
> --- a/src/wayland-util.h
> +++ b/src/wayland-util.h
> @@ -56,7 +56,7 @@ struct wl_interface {
>
>  struct wl_object {
>         const struct wl_interface *interface;
> -       void (* const * implementation)(void);
> +       const void *implementation;
>         uint32_t id;
>  };
>
> --
> 1.8.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130328/8d05d8bd/attachment-0001.html>


More information about the wayland-devel mailing list