Vala: shared_library added.
This commit is contained in:
parent
05097f7717
commit
6d4cb05e68
|
@ -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));
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,9 @@
|
|||
namespace MyMath {
|
||||
public int sum(int a, int b) {
|
||||
return(a + b);
|
||||
}
|
||||
|
||||
public int square(int a) {
|
||||
return(a * a);
|
||||
}
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue