程式語言 - Wayland - Client - Connect Server



參考資訊:
https://jan.newmarch.name/Wayland/index.html
https://wayland.freedesktop.org/docs/html/apa.html
https://bugaevc.gitbooks.io/writing-wayland-clients/content/

main.c

#include <stdio.h>
#include <wayland-client.h>
 
int main(int argc, char **argv)
{
    struct wl_display *dis = wl_display_connect(NULL);
 
    if (dis == NULL) {
        printf("failed to connect !\n");
        return -1;
    }

    printf("connected !\n");
    wl_display_disconnect(dis);
    return 0;
}

編譯、執行

$ gcc main.c -o main -lwayland-client
$ ./main
    connected !