Vala: shared_library added.

This commit is contained in:
Kolan Sh 2013-02-07 14:52:39 +04:00
parent 05097f7717
commit 6d4cb05e68
4 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,7 @@
using MyMath;
public void main() {
stdout.printf("\nTesting shlib");
stdout.printf("\n\t2 + 3 is %d", sum(2, 3));
stdout.printf("\n\t8 squared is %d\n", square(8));
}

View File

@ -0,0 +1,6 @@
#!/bin/sh
valac --library=test_shared -H test_shared.h test_shared.vala -X -fPIC -X -shared -o test_shared.so
valac test_shared.vapi main.vala -X test_shared.so -X -I. -o valatest
export LD_LIBRARY_PATH=.
./valatest

View File

@ -0,0 +1,9 @@
namespace MyMath {
public int sum(int a, int b) {
return(a + b);
}
public int square(int a) {
return(a * a);
}
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
valac -C --library=test_shared -H test_shared.h test_shared.vala -X -shared -o test_shared.dll
valac test_shared.vapi main.vala -X test_shared.dll -X -I. -o valatest.exe
./valatest.exe