~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to examples/link-examples-so/ext6f.dia.ref

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
// Demo file for ext6f example
 
3
 
 
4
 
 
5
// builder code for ext6f.c
 
6
 
 
7
link_name = 'ext6f';    // functions to be added to the call table
 
8
 
 
9
flag  = "f";            // ext6f is a C function
 
10
 
 
11
files = ['ext6f.o' ];   // objects files for ext6f
 
12
 
 
13
libs  = [];             // other libs needed for linking
 
14
 
 
15
 
 
16
// the next call generates files (Makelib,loader.sce) used
 
17
 
 
18
// for compiling and loading ext6f and performs the compilation
 
19
 
 
20
 
 
21
ilib_for_link(link_name,files,libs,flag);
 
22
   generate a loader file
 
23
   generate a Makefile: Makelib
 
24
   running the makefile
 
25
 
 
26
 
 
27
// load new function code in the scope of call
 
28
 
 
29
// using the previously generated loader
 
30
 
 
31
exec loader.sce
 
32
 
 
33
// generated by builder.sce: Please do not edit this file
 
34
 
 
35
// ------------------------------------------------------
 
36
 
 
37
ext6f_path=get_file_path('loader.sce');
 
38
 
 
39
link(ext6f_path+'/libext6f.so',['ext6f'],'f');
 
40
Loading shared executable0./libext6f.so
 
41
 
 
42
shared archive loaded
 
43
 
 
44
Linking ext6f 
 
45
 
 
46
Link done
 
47
 
 
48
 
 
49
 
 
50
 
 
51
// test new function through the call function
 
52
 
 
53
//reading  vector with name='a' in scilab internal stack
 
54
 
 
55
 
 
56
a=[1,2,3];b=[2,3,4];
 
57
 
 
58
c=call('ext6f','a',1,'c',b,2,'d','out',[1,3],3,'d');
 
59
 
 
60
if norm(c-(a+2*b)) > %eps then bugmes();quit;end
 
61
 
 
62