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

Giulio Camuffo giuliocamuffo at gmail.com
Thu Mar 28 06:55:51 PDT 2013


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



More information about the wayland-devel mailing list