[scilab-Users] Link between scilab and c program

Collette Yann ycollet at freesurf.fr
Fri Apr 24 06:05:37 CEST 2009


For the compilation of your program, try this:

gcc -shared -o dados_para_scilab.so -c dados_para_scilab.c

You must build a shared library instead of a classical object.

YC

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 
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/> 
> - Celebridades 
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/celebridades/> 
> - Música 
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/m%C3%BAsica/> 
> - Esportes 
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/esportes/> 





More information about the users mailing list