Name

ilib_build — utility for shared library management

Calling Sequence

ilib_build(lib_name,table,files,libs [,makename,ldflags,cflags,fflags,ismex, cc])

Parameters

lib_name

a character string, the generic name of the library without path and extension.

table

2 column string matrix giving the table of pairs 'scilab-name', 'interface name'

files

string matrix giving source (from Scilab 5.0) or object files needed for shared library creation

libs

string matrix giving extra libraries needed for shred library creation

makename

character string. The path of the Makefile file without extension.

ldflags,cflags,fflags

character strings to provide options for the loader, the C compiler and the Fortran compiler.

ismex

Internal variable to specify if we are working with mex or not.

cc

Provide the name of the C compiler.

Description

This tool is used to create shared libraries and to generate a loader file which can be used to dynamically load the shared library into Scilab with addinter

Many examples are provided in SCI/modules/dynamic_link/examples directory.

Note that a compiler must be available on the system to use this function.

Examples


//Here with give a complete example on adding new primitive to Scilab
//create the procedure files
f1=['extern double fun2();'
    'void fun1(double *x, double *y)'
    '{*y=fun2(*x)/(*x);}'];

mputl(f1,'fun1.c')

f2=['#include <math.h>'
    'double fun2(double x)'
    '{ return( sin(x+1.));}'];
mputl(f2,'fun2.c');

//creating the interface file
i=['#include ""stack-c.h""'
	'#include ""stackTypeVariable.h""'
   'extern int fun1 ( double *x, double *y);'
   'int intfun1(char *fname)' 
   '{'
   '  int m1,n1,l1;'
   '  CheckRhs(1,1);'
   '  CheckLhs(1,1);'
   '  GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);'
   '  fun1(stk(l1),stk(l1));'
   '  LhsVar(1) = 1;'
   '  return 0;'
   '}'];
mputl(i,'intfun1.c')

//creating the shared library (a gateway, a Makefile and a loader are 
//generated. 

files=['fun1.c','fun2.c','intfun1.c'];
ilib_build('foo',['scifun1','intfun1'],files,[]);

// load the shared library 

exec loader.sce 

//using the new primitive
scifun1(33)
 
  

See Also

addinter , link , ilib_compile , ilib_gen_Make , ilib_gen_gateway , ilib_gen_loader , ilib_for_link