On Thu, Jun 30, 2011 at 11:21:41AM +0100, Sam Thursfield wrote:

> Hi everyone
> I've just run across an interesting and unexpected problem, which I'd
> like to share in case anyone has considered it before or to warn any
> future victims. In a nutshell:
> 
> 1. 'make dist' generates a platform-independent tarball which can be
> compiled on any platform
> 2. Vala should not be required to build from a tarball, so the
> generated .c files are dist'ed
> 3. I have some platform-specific #if OS_BEOS, #if OS_WIN32 etc. code
> in my vala source
> 
> My dist tarball is therefore inconsistent, because to compile on
> platforms other than the one that did the 'make dist' I actually still
> need valac to regenerate the C files.
> 
> Are there plans to drop 2) once Vala's plans for world domination come
> closer to fruition? Or is platform-specific Vala code discouraged?

The way I’ve worked around this when I found myself in the same situation
was to segregate platform–specific code to a bunch of small C routines,
using G_OS_* macros to detect the compilation platform, and calling those
routines from Vala.

It’s not the best way in the world, but it certainly works OK if you have
just a little amount of platform–specific code. Which, since you’re
using Vala and by extension the portable GLib library, should be the case.

-- 
Andrea Bolognani <[email protected]>
Resistance is futile, you will be garbage collected.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to