Re: [Vala] Xlib bindings?
- From: Martin Olsson <mnemo minimum se>
- To: "Michael B. Trausch" <mike trausch us>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Xlib bindings?
- Date: Sun, 15 Feb 2009 11:09:52 +0100
I think most of the VAPI bindings that exist are stored in Vala repo
under the "vapi" directory.
VAPI files have a syntax very close to Vala itself and the native
methods are referenced using CCode attributes attached to a method
or a class. The idea is in many ways similar to DllImport and it
is certainly possible to define partial bindings (just a handful
data types and functions that you need instead of everything
exported by a .SO file).
I've not seen any XLib VAPI yet either. You might want to look into
"XCB" as well though. Note, however, that there is still some things
that are hard to do using XCB (like direct rendering Mesa isn't fully
ported yet for example):
http://lists.freedesktop.org/archives/xcb/2009-February/004285.html
Martin
Michael B. Trausch wrote:
I didn't see any packaged with Vala, and searching around on Google
hasn't yet yielded me an answer, so I am hoping that someone can say
definitively whether or not there are bindings to Xlib (or a work in
progress to that effect).
Any idea? It would be nice to have. I'm trying to learn how to create
bindings for it at the moment as I am considering Vala for a project of
mine, but it requires working with Xlib or otherwise using the X11
protocol.
Also, a question regarding bindings: Do they *have* to be in .vapi
files, or is it possible to create a class that does something like
C#/Mono/.NET's P/Invoke? For example, if I wanted to create an X11
class, in C# I could do:
namespace Foo {
public class X11 {
[DllImport(libx11)]
private static extern IntPtr XOpenDisplay(string dispName);
IntPtr x11_display;
public X11() {
x11_display = X11.XOpenDisplay(null);
}
}
}
The idea being that you would import the raw API entrypoint into the
class as a private static method, and then it would be wrapped by the
implementing class in some way. In this way, you can quickly integrate
code that exists without having to write full bindings for it, just
using the functionality that you need from it. This would likely be
ideal for what I'm working on.
--- Mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]