Problems with intersci

Alfredo Jaramillo ajaramillopalma at gmail.com
Mon Feb 9 17:56:18 CET 2009


Hi!, I'm trying to use a C routine on the interface of Scilab 4.1.2
The C file is cthomas.c and contains:

#include "global.h"
#include "machine.h"

int C2F(cthomas)(double *b, double *a,double *c, double *q,int *n, double
*x){
        int i,j;
        double *u=malloc(sizeof(double)*(*n));
        double *y=malloc(sizeof(double)*(*n));

        u[0]=a[0];
        for(i=0;i<*n-1;i++){
                x[i]=b[i]/u[i];
                u[i+1]=a[i+1]-x[i]*c[i];
        }
        y[0]=q[0];

        for(i=0;i<*n-1;i++)
                y[i+1]=q[i+1]-x[i]*y[i];

        x[*n-1]=y[*n-1]/u[*n-1];
        for(i=*n-2;i>=0;i--)
                x[i]=(y[i]-c[i]*x[i+1])/u[i];

        free(u);free(y);
        return(0);
}

I Compilate this file with:
gcc -I ~/bin/scilab-4.1.2/routines -c cthomas.c -o cthomas.o

No warning message appears. In the same directory I create the file
thomas.desc, that contains:

thomas  b       a       c       q
b       column  n-1
a       column  n
c       column  n-1
q       column  n
x       column  n

cthomas  b       a       c       q       n       x
b       double
a       double
c       double
q       double
n       integer
x       double

out     sequence        x
****************************

Before compilation I execute:

ajaramillo at ajaramillo:~/work/miguel/scilab>
~/bin/scilab-4.1.2/bin/intersci-n thomas

INTERSCI Version 3.0 (SEP 2000)
    Copyright (C) INRIA/ENPC All rights reserved

**************************
processing SCILAB function "thomas"
  generating C interface for function (cthomas) Scilab function"thomas"
C file "thomas.c" has been created
Scilab file "thomas.sce" has been created

file "thomas_builder.sce" has been created

Now, on scilab I wrote the order:
-->exec "thomas_builder.sce"

-->// generated with intersci

-->ilib_name = 'libthomas'              // interface library name
 ilib_name  =

 libthomas


-->table =["thomas","intsthomas"];

-->ilib_build(ilib_name,table,files,libs);
ilib_build(ilib_name,table,files,libs);
                             !--error 4
undefined variable : files
at line       5 of exec file called by :
exec "thomas_builder.sce"


-->

I don't understand this...moreover, the file thomas.sce wasn't exists

Trying to fix this.. on base of the examples from
<SCIDIR>/examples/intersci-examples-so/

I modificate the thomas_builder.sce file on the next way:


// generated with intersci
ilib_name = 'libthomas'         // interface library name
libs=[];
files=['cthomas.o'];
table =["thomas","intsthomas"];
ilib_build(ilib_name,table,files,libs);

Now, when I execute the builder:

-->exec "thomas_builder.sce"

-->// generated with intersci

-->ilib_name = 'libthomas'              // interface library name
 ilib_name  =

 libthomas

-->libs=[];

-->files=['cthomas.o'];

-->table =["thomas","intsthomas"];

-->ilib_build(ilib_name,table,files,libs);
   generate a gateway file
   generate a loader file
   generate a Makefile: Makelib
   running the makefile
   compilation of cthomas
   building shared library (be patient)

And before that, I execute:
-->exec "loader.sce"

-->// generated by builder.sce: Please do not edit this file

-->// ------------------------------------------------------

-->libthomas_path=get_file_path('loader.sce');

-->functions=[ 'thomas';
-->];

-->addinter(libthomas_path+'/libthomas.so','libthomas',functions);
/home/ajaramillo/work/miguel/scilab/libthomas.so: undefined symbol:
intsthomas
addinter(libthomas_path+'/libthomas.so','libthomas',functions);
                                                       !--error 236
link: the shared archive was not loaded
at line       6 of exec file called by :
exec "loader.sce"


-->

But again an error appears, this time I don't found a way to "fix" it

Can you help me with this please? Thanks in advance


Alfredo Jaramillo Palma
Mathematics Engineering Student
La Frontera University
Chile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20090209/487c0ef3/attachment.htm>


More information about the users mailing list