Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.2 - Русский

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

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

Справка Scilab >> Dynamic/incremental 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]]]]]]])



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


string matrix giving source files needed for shared library creation.


string matrix giving extra libraries needed for shared library creation


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


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

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.


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


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


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


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


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


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


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


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.

On the internal technical level, under GNU/Linux and Mac OS X, the ilib_* function are based on the autotools. First, a configure is executed to detect compilers available. Then, a make is launched with the provided arguments. For more information: Full technical description of the incremental link / dynamic link

Since version 5.3.2, under GNU/Linux, Scilab detects where the libstdc++ is located (thanks to the command gcc -print-search-dirs|grep ^install:|awk '{print $2}'). Previously, the dynamic link was using the libstdc++ embedded in Scilab.

Examples (C code)

if haveacompiler() then

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);}'];


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


// load the shared library

exec loader.sce

//using the new primitive
if norm(c-(a+b)) > %eps then pause,end


See Also

  • addinter — new functions interface dynamic link at run time.
  • link — dynamic linker
  • ilib_compile — ilib_build utility: executes the Makefile produced by ilib_gen_Make
  • ilib_gen_Make — utility for ilib_build: produces a Makefile for building shared libraries
  • ilib_gen_gateway — utility for ilib_build, generates a gateway file.
  • ilib_gen_loader — utility for ilib_build: generates a loader file
  • ilib_build — utility for shared library management
  • api_scilab — api_scilab is the Scilab interface to read/write data from/to Scilab memory


5.4.0 This function no more accepts files with ".o" or ".obj" extensions as source files.
Report an issue
<< ilib_compile Dynamic/incremental Link 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 Apr 01 10:27:30 CEST 2015