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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright Enpc
// basic test for link
foo=['void foo(double *a,double *b,double *c)';
'{ *c = *a + *b; }' ];
// we use TMPDIR for compilation
if ~c_link('foo') then
path = getcwd();
chdir(TMPDIR);
mputl(foo,'foo.c');
ilib_for_link(['foo'],'foo.o',[],"c");
generate a loader file
generate a Makefile
running the makefile
compilation of foo
building shared library (be patient)
exec loader.sce ;
shared archive loaded
Link done.
chdir(path)
ans =
0.
end
//5+7 by C function
call('foo',5,1,'d',7,2,'d','out',[1,1],3,'d')
ans =
12.
// basic test for addinter
//--------------------------
if ~c_link('libintertest') then
files=['addinter.o'];
ilib_build('libintertest',['scifun1','intfun1'],files,[]);
generate a gateway file
generate a loader file
generate a Makefile: Makelib
running the makefile
compilation of addinter
building shared library (be patient)
// load the shared library
exec loader.sce ;
shared archive loaded
if norm(scifun1(%pi)- sin(%pi+1)/%pi ) > %eps then pause;end
end
|