Re: [Vala] Making libraries with Vala



Hi Ildar,

2009/9/4 Ildar Mulyukov <ildar users sourceforge net>:
       Hi!

As I see, this topic was not discussed in details before.
I am writing a library with Vala. And want to discuss some caveats of this
task.
1. Valac supports "--library" option, but still cannot build one with one
shot - it cannot link a library (is it true?)

yes and no,
Vala doesn't know how to compile a library by itself, but you can pass
extra arguments to the C compiler using -X (for example -X -fPIC -X
-shared), but this is not portable.

2. Not all of the Vala features are accessible from the program using a
library (This is my guess. I think it's worth to have a document (or wiki
page) explicitly naming these features)

I don't think so, all vala features should be accecible to whatever
program using them (but I may be wrong).

2a. I found a regression - in-library defined Error Domain is not fully
accessible from a client program. This is because a compiled Error Domain
looks like:
#define ZZZZZ_ASSERTION_ERROR zzzzz_assertion_error_quark ()
which is lost in library form.
Version 0.6 was 100% working. (It had .h files along with vapi)

yes, this has changed in 0.7, you nedd to pass '-H my_lib.h' to valac
to generate a header.

3. May be something I just didn't bump in yet.

As an example of a library written in vala, you can take a look at
libgee (or vala itself) to see how this is managed (if you can depend
on automake 1.11, this is even easier).

HTH,
Abderrahim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]