Re: [Vala] How to mix vala code and C code in one automake-based project correctly?



On Thu, 2011-10-27 at 16:58 +0800, PCMan wrote:
If I did not get it wrong, it seems to generate a single header file "g
mpc-extras.h".
For what I want, I prefer generating file_a.[ch] for file_a.vala,
file_b.[ch] for file_b.vala, and file_c.[ch] for file_c.vala. Each vala file
can has its own generated *.c and *.h files.
Is this possible with autotools?

Because of how Vala compilation works, the Vala compiler has to read all
the related vala files when compiling just one, in order to resolve
dependencies and includes between them. Thus, the most efficient way to
compile vala files to C is to compile them all in a single invocation of
the valac command - this is what automake does.

When you do this with valac, you can only generate a single .h file for
the entire vala code section.

If you want to have separate .h files for portions of your code, your
best option would be divide the code into separate 'convenience
libraries' (use the noinst_LIBRARIES or noinst_LTLIBRARIES variables)
based on natural divides between portions of the code; then valac can
generate a separate .h file for each convenience library.

-- 
Calvin Walton <calvin walton kepstin ca>




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