<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>ilib_for_link</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>May 2000</DATE>
  <SHORT_DESCRIPTION name="ilib_for_link"> utility for shared library management with link</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>libn=ilib_for_link(names,files,libs,flag [,makename
      [,loadername [,libname [,ldflags [,cflags [,fflags [,cc]]]]]]])  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>names</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a string matrix giving the entry names which are to be linked.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>files</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: string matrix giving objects files needed for shared library creation</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>libs</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: string matrix giving extra libraries needed for shred library creation</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>flag</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a string flag (&quot;c&quot; or &quot;f&quot;) for C or Fortran entry points.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>makename</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: character string. The pathname of the Makefile file without extension (default value <VERB>Makelib</VERB>).</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>loadername</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: character string. The pathname of the loader file (default
	    value is   <VERB>loader.sce</VERB>).</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>libname</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: optional character string. The name of the generated shared
	    library (default value  is '', and in this case the name is derived
	    from <VERB>names(1)</VERB>).</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>ldflags</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: optional character string. It can be used to add specific linker options in the
	    generated Makefile. Default value is ''</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
     <PARAM_ITEM>
        <PARAM_NAME>cflags</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: optional character  string. It can be used to add specific C compiler options in the
	    generated Makefile. Default value is ''</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
     <PARAM_ITEM>
        <PARAM_NAME>fflags</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: optional character  string. It can be used to add specific Fortran compiler options in the
	    generated Makefile. Default value is ''</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    <PARAM_ITEM>
        <PARAM_NAME>cc</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: optional character  string. It can be used to specify a C compiler. Default value is ''</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>libn</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: character string. The path of the really generated shared library file.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    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 <VERB>link</VERB> function. New entry points 
    given by <VERB>names</VERB> are then accessible through the <VERB>call</VERB> 
    function or with non linear tools <VERB>ode</VERB>, <VERB>optim</VERB>,...</P>
    <P>
    The file to compile are supposed to be located given by
    <VERB>makename</VERB>. If <VERB>makename</VERB> sets a path different to the
    current directory, <VERB>loader</VERB> script must be located in
    the same directory using the <VERB>loadername</VERB> variable.</P>
    <P>
    Many examples are provided in <VERB>examples/link-examples-so</VERB>
    directory.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[

f1=['int ext1c(n, a, b, c)'
    'int *n;     double *a, *b, *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.o',[],"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

 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>addinter</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>link</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ilib_compile</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ilib_gen_Make</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ilib_gen_gateway</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ilib_gen_loader</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ilib_for_link</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
