[scilab-Users] Link between scilab and c program

Sylvestre Ledru sylvestre.ledru at scilab.org
Fri Apr 24 13:40:27 CEST 2009


the .o is misleading. It is the name of the target.

You can delegate the build to Scilab:

For example:
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") 


Sylvestre

Le jeudi 23 avril 2009 à 16:27 -0700, Lucio Agostinho Rocha a écrit :
> Hi,
> 
> I want to create a C program that executes a function inside Scilab.
>         
> I use Scilab 5.1.1 in Kubuntu, gcc 4.3.2
> 
> I create a simple function in C to try this.  The name's program is
> 'dados_para_scilab.c' :
> 
> double funcao(x)
> double *x;
> {
>   double result = (*x)+1;
> }//end function
> 
> Then, I compile:
> 
> gcc -o dados_para_scilab.o -c dados_para_scilab.c
> 
> And I put the 'dados_para_scilab.o' file inside the work directory
> that I defined for Scilab (with 'chdir' command).
>                 
> Then, inside Scilab:
> 
> --> link('dados_para_scilab.o','funcao','c')
> 
> But the following message is showed:
> 
> Link failed for dynamic library 'dados_para_scilab.o'
> ...only: ET_DYN e ET_EXEC can be loaded.
> link: The shared archive was not loaded: (null)
> 
> What am I doing wrong? Someone could help me? It would be a great
> value to put some C code and the steps to make this working.
> 
> Thanks in advance,
> 
> Lucio
> ...........
> 
> 
> ______________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! + Buscados: Top 10 -
> Celebridades - Música - Esportes




More information about the users mailing list