Why finding the solution to my own question (use Con (native "libxcb.so" "xcb_connect" 'N 'Con) (native "libxcb.so" "xcb_connection_has_error" 'I Con) ) doesn't make me feel less retarded?
--- Nicola On Sun, 1 Dec 2019 at 12:10, Nicola Todorov <nmtodo...@gmail.com> wrote: > Hi everyone, > > I am trying out the FFI functionality of PicoLisp and am having some > difficulty understanding how struct arguments are passed when the struct in > question contains nested structs. My question is do I have to somehow > describe the whole thing using nested list structure or there is simpler > way? (this is PicoLisp we are talking about after all) > > To illustrate/clarify the question, here is an example: > I want to talk to libxcb and for this I do > (native "libxcb.so" "xcb_connect" > '(I N I N N N N N) > 0 0 ) # Passing NULL to the arguments is fine > > The result of this should be xcb_connection_t struct which contains what > ... more structs. > If I am to check whether the connection is done I have to issue another > 'native' call to 'xcb_connection_has_error' function which takes the output > of 'xcb_connect' > To paraphrase my initial question - how do I do that in the simplest way > possible? > > Ref: > xcb_connection_t > <https://xcb.freedesktop.org/manual/structxcb__connection__t.html> > xcb_connection_has_error > <https://xcb.freedesktop.org/manual/group__XCB__Core__API.html#ga70a6bade94bd2824db552abcf5fbdbe3> > xcb_connect > <https://xcb.freedesktop.org/manual/group__XCB__Core__API.html#ga094470586356d1764e69c9a1882966c3> > > --- Nicola >