Hija,
First of all: I'm pretty new to Vala, don't shoot me if what's coming
next is a very bad idea.
While working with Vala I thought it could be useful (especially during
quick development, when you got no build setup in place yet) to be able
to add C source files to the valac command line so these files get
linked in in the resulting object file/executable too.
Patch is attached (using git-svn).
Regards,
Nicolas
Here' a sample session:
nicolas sky ~/Projects/jhbuild/tmp $ cat vala-c-test.vala
using GLib;
public class ValaCTest {
public static int foo(string[] args) {
message("Hello from vala-land");
foreach(string arg in args) {
stdout.printf("Arg: %s\n", arg);
}
return 0;
}
}
nicolas sky ~/Projects/jhbuild/tmp $ cat vala-c-test-main.c
#include <stdio.h>
#include "vala-c-test.h"
int main(int argc, char *argv[]) {
printf("Hello from C land\n");
printf("I got %d arguments\n", argc);
return vala_ctest_foo(argc, argv);
}
nicolas sky ~/Projects/jhbuild/tmp $ valac -o vala-c-test vala-c-test.vala vala-c-test-main.c
Compilation succeeded - 0 warning(s)
nicolas sky ~/Projects/jhbuild/tmp $ ./vala-c-test this stuff works
Hello from C land
I got 4 arguments
** Message: vala-c-test.vala:5: Hello from vala-land
Arg: ./vala-c-test
Arg: this
Arg: stuff
Arg: works
Attachment:
0001-Allow-addition-of-compiled-in-C-files-to-command-lin.patch
Description: application/mbox
Attachment:
signature.asc
Description: This is a digitally signed message part