Vala: extern_c.
This commit is contained in:
parent
1e6235a449
commit
ff421afbd6
|
@ -0,0 +1,7 @@
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
void c_func (gchar *str,
|
||||||
|
GHashTable *htable)
|
||||||
|
{
|
||||||
|
g_printf ("Do something with str and htable...");
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cc -c `pkg-config --cflags glib-2.0` c_code.c -o c_code.o
|
||||||
|
valac -c vala_code.vala
|
||||||
|
cc *.o -o app `pkg-config --libs glib-2.0 gobject-2.0`
|
|
@ -0,0 +1,8 @@
|
||||||
|
extern void c_func (string? str, HashTable<string, string> hash_func);
|
||||||
|
|
||||||
|
void main () {
|
||||||
|
stdout.printf ("Hello world!\n");
|
||||||
|
|
||||||
|
var hash_func = new HashTable<string, string> (str_hash, str_equal);
|
||||||
|
c_func ("abc", hash_func);
|
||||||
|
}
|
Loading…
Reference in New Issue