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

I'm the developer of LXDE project and I started using Vala last night.
Most parts of our existing code are written in pure C with or without
Now I want to do further development in vala.
To mix vala code with existing C code, I cannot find any good guide on the
Some existing guides are for writing vapi files to call C code in vala.
Others telling you how to compile vala code with automake or valac.

However, none of them solve my problems.
I want to have a project developed with vala and C.
I need to call the functions and GObjects in C files from vala.
Also, I need to call vala generated objects and functions from my C code as
I cannot use the "valac -C --header xxxx.h" trick as valac is called by
In addition, if I write something like this in Makefile.am, it does not

myprog_SOURCES= \
  file1.c \
  file2.c \
  file3.vala \
  file4.vala \

In this way, C code will be treated as vala, or vala code will be treated as
Autotools do not seem to handle this well. What's the correct way to do it?

For calling vala code from C code, a generated *.h file is needed.
I tried adding "--header xxx.h" to VALA_FLAGS and it seemed to work.
However, it generated a huge single header file for all *.vala files
compiled rather than file1.h for file1.vala, file2.h for file2.vala, etc.
How to generate separate *.h files for every single vala file with
Or, if this is not supported by autotools, can CMake do this?

I hope these problems can be solved easily so I can do future development in
Vala rather than having to keep C/GObject.

Thank you all

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