blob: 5681b0d27322e80e615e1767aa921b8ea348cec1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
[CCode (cname = "g_strdup", cheader_filename = "glib.h")]
extern string strdup (string s);
[CCode (cname = "vala_some_thing")]
extern void some_thing ();
namespace Foo {
[CCode (cname = "g_strdup", cheader_filename = "glib.h")]
extern string strdup (string s);
[CCode (cname = "vala_some_thing")]
extern void some_thing ();
}
public class Bar {
[CCode (cname = "g_strdup", cheader_filename = "glib.h")]
public static extern string strdup (string s);
[CCode (cname = "vala_some_thing")]
public static extern void some_thing ();
}
void main () {
assert ("foo" == strdup ("foo"));
assert ("foo" == Foo.strdup ("foo"));
assert ("foo" == Bar.strdup ("foo"));
assert ((void*) some_thing != null);
assert ((void*) Foo.some_thing != null);
assert ((void*) Bar.some_thing != null);
}
|