On 27 October 2011 12:53, PCMan <[email protected]> wrote: > Hello, > 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 > GObject. > 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 > internet. > 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.
For C from Vala calls, feel free to borrow ideas from Spek: https://github.com/alexkay/spek Also check out Sampala: https://github.com/tadeboro/Sampala > Also, I need to call vala generated objects and functions from my C code as > well. > I cannot use the "valac -C --header xxxx.h" trick as valac is called by > automake. > In addition, if I write something like this in Makefile.am, it does not > work. > > bin_PROGRAMS=myprog > myprog_SOURCES= \ > file1.c \ > file2.c \ > file3.vala \ > file4.vala \ > file5.c > > In this way, C code will be treated as vala, or vala code will be treated as > C. > 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 > autotools? > 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 > > _______________________________________________ > vala-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/vala-list > > _______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
