Basic API usage

Jan Bruns code at abnuto.de
Wed Sep 9 19:32:56 UTC 2020


On 09.09.20 17:44, Jan Bruns wrote:
> Ok. I now have an even earlier point of missing knowledge than I 
> expected:
>
> Why does the generated version of wayland-client-protocol.h reference 
> a server object called "wl_registry_interface"?

It is (contrary to what me thought, again mixing up the array and 
variadic versions) used as something like a fake-interface, so that the 
new-id code gets a chance to get executed.


Gruss


Jan Bruns


PS: Here's the working, untyped example, that prints false, false, true:


{$LINKLIB wayland-client}

const
wl_opcode_get_registry=1;

var
wl_registry_interface : pointer; external; //whatever type it is

function wl_proxy_marshal_array_constructor_versioned(proxy : pointer; 
opcode : dword; args : pointer; intf : pointer; version : dword) : 
pointer; cdecl; external;
function wl_proxy_marshal_array_constructor(proxy : pointer; opcode : 
dword; args : pointer; intf : pointer) : pointer; cdecl; external;
function wl_display_connect(name : Pchar) : pointer; cdecl; external;

var
display : pointer;
registry : pointer;
nilptr : pointer;

begin
   nilptr := nil;
   display := wl_display_connect(nil);
   if (display<>nil) then begin
     registry := 
wl_proxy_marshal_array_constructor(display,wl_opcode_get_registry, at nilptr, at wl_registry_interface);
     writeln('reg=nil?',registry=nil);
     writeln('ptr=nil?',nilptr=nil);
     writeln('ptr=reg?',nilptr=registry);
   end else writeln('no connection to display.');
end.



More information about the wayland-devel mailing list