Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - Português

Change language to:
English - Français - 日本語 -

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Manual Scilab >> Link Dinâmico/incremental > ilib_for_link

ilib_for_link

utility for shared library management with link

Calling Sequence

libn=ilib_for_link(names,files,libs,flag [,makename [,loadername [,libname [,ldflags [,cflags [,fflags [,cc]]]]]]])

Arguments

names

a string matrix giving the entry names which are to be linked.

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 shared library creation

flag

a string flag ("c" or "f") for C or Fortran entry points.

makename

character string. The pathname of the Makefile file without extension (default value Makelib).

This parameter is useless since Scilab 5.0.

A warning will be displayed in Scilab 5.3 if you use another value that the default.

loadername

character string. The pathname of the loader file (default value is loader.sce).

libname

optional character string. The name of the generated shared library (default value is "", and in this case the name is derived from names(1)).

ldflags

optional character string. It can be used to add specific linker options in the generated Makefile. Default value is ""

cflags

optional character string. It can be used to add specific C compiler options in the generated Makefile. Default value is ""

fflags

optional character string. It can be used to add specific Fortran compiler options in the generated Makefile. Default value is ""

cc

optional character string. It can be used to specify a C compiler. Default value is ""

libn

character string. The path of the really generated shared library file.

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 the link function. New entry points given by names are then accessible through the call function or with non linear tools ode, optim,...

The file to compile are supposed to be located given by makename. If makename sets a path different to the current directory, loader script must be located in the same directory using the loadername variable.

Many examples are provided in SCI/modules/dynamic_link/examples directory. They are all released into the public domain.

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

Languages handle by this function are: C, C++, Fortran and Fortran 90.

Examples (C code)

if haveacompiler() then

chdir(TMPDIR)
f1=['int ext1c(int *n, double *a, double *b, double *c)'
    '{int k;'
    '  for (k = 0; k < *n; ++k) '
    '      c[k] = a[k] + b[k];'
    '  return(0);}'];

mputl(f1,'fun1.c')

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

ilib_for_link('ext1c','fun1.c',[],"c") 

// load the shared library 

exec loader.sce 

//using the new primitive
a=[1,2,3];b=[4,5,6];n=3;
c=call('ext1c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
if norm(c-(a+b)) > %eps then pause,end

end
<< ilib_compile Link Dinâmico/incremental ilib_gen_Make >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jan 26 16:24:43 CET 2011