[Vala] Recommended way for combined C with Vala/Genie project?



I've just got this error that made me wonder about valac's hidden capabilities:

error: test.g is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.

I assume a .c file is passed straight through to the C compiler along with the generated C files from .vala 
and .gs files. Is this a recommended way of creating a combined C with Vala/Genie project?

I note XFCE decided to combine C with Vala. From a couple of blog post [1][2] it looks as though they use 
automake to create C files from Vala and then distribute and compile those files for the whole project. The 
argument being different versions of valac can produce different C files so it is more stable for a 
distributed version to build from the generated C files.

I also found the Parallel Builds [3] page. This is an interesting approach with, as I understand it, an 
intermediate object file for each vala file. These could be linked with object files from C or C++.

Then there is the --compile option of valac to produce object files.

So at the moment I'm thinking for large, mixed language projects, it is better to create object files and 
link outside of valac.

I am writing some documentation for Genie and was about to finish the attached diagram with arrows when I 
stumbled upon valac accepting .c files. At present I'm thinking this feature isn't too useful and it is 
better to create object files and link using another tool. This is also useful for GIR and using Vala/Genie 
binaries in Python, node.js, PHP, etc. So it is probably better for documentation to introduce the more 
general process.


Thanks for any thoughts.



Al Thomas

1 - http://blog.m8t.in/2009/09/build-project-with-vala.html
2 - http://blog.m8t.in/2009/12/messing-up-with-vala-again.html
3 - https://wiki.gnome.org/Projects/Vala/Documentation/ParallelBuilds


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