kubo39's blog

ただの雑記です。

Dからxlibを触ってみる(ほんとにさわってみるだけ)

ちょっと興味がでたのでやってみる.

前準備.

$ sudo apt-get apt-file
$ apt-file update
$ apt-file search  XInput.h
libxi-dev: /usr/include/X11/extensions/XInput.h
$ apt-file search Xrandr.h
...
libxrandr-dev: /usr/include/X11/extensions/Xrandr.h
$ sudo apt-get install libxrandr-dev libxi-dev 

githubから最新版をcloneしてきてビルド.

$ git clone git://github.com/D-Programming-Deimos/libX11
$ cd libX11
$ make shared-lib
$ sudo make install

example.dを動かしてみる.

$ dmd -c example.d -I/usr/local/include/d/DX11
$ dmd example.o -L-lX11 /usr/local/lib/libDX11-dmd.a

コマンド一発でやりたかったらこんなかんじ.

$ dmd example.d -L-lX11 /usr/local/lib/libDX11-dmd.a -I/usr/local/include/d/DX11