[scilab-Users] Run C code function in Scilab

KLUGESHERZ, CHRISTIAN (CHRISTIAN) christian.klugesherz at alcatel-lucent.com
Fri Jul 23 11:15:29 CEST 2010


Ok,

Finally I tried to follow the example "addinter.c" in unit_tests directory (See also below)

With "addinter.c" in a specific directory:

When I run in Scilab

// Chemin de MinGW-toolbox
root_path = getenv('TOOLBOX_MINGW_PATH', 'D:\Documents and Settings\KLUGES1\My Documents\Perso\Simul_scilab_c\Install_Simul_C_Scilab\MinGW-toolbox');
exec(root_path + '\loader.sce');

Mingw Compiler support for Scilab
            Load macros
            Load help

 --------> (As I said it's OK :-) )

 --------> (Now to the issue)

files=['addinter.c'];
ilib_build('libintertest',['scifun1','intfun1'],files,[]);

I got

-->ilib_build('libintertest',['scifun1','intfun1'],files,[]);
   Generate a gateway file
   Generate a loader file
   Generate a Makefile: Makelib
 !--error 144
Undefined operation for the given operands.

check or define function %b_a_c for overloading.

at line      54 of function dlwGenerateMakefile called by :
at line      68 of function ilib_gen_Make called by :
at line      96 of function ilib_build called by :
ilib_build('libintertest',['scifun1','intfun1'],files,[]);

Please could you help

Thanks

Christian


PS: File: "addinter.c"

#include <math.h>
#include "stack-c.h"

static double fun2(double x);

void fun1(double *x,double *y)
{
  *y=fun2(*x)/(*x);
}

static double fun2(double x)
{
  return( sin(x+1));
}

int intfun1(char *fname)
{
  int m1,n1,l1;
  CheckRhs(1,1);
  CheckLhs(1,1);
  GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
  fun1(stk(l1),stk(l1));
  LhsVar(1) = 1;
  return 0;
}


________________________________
De : KLUGESHERZ, CHRISTIAN (CHRISTIAN) [mailto:christian.klugesherz at alcatel-lucent.com]
Envoyé : vendredi 23 juillet 2010 09:22
À : users at lists.scilab.org
Objet : RE: [scilab-Users] Run C code function in Scilab

Hi all

OK,

I downloaded
* ftp://ftp.equation.com/gcc/gcc-4.5.0-32.exe
* git://git.forge.scilab.org/MinGW-toolbox.git

And build: builder.sce

And it seems to work. builder.sce then the loader are OK

Fine :-))

But now, what is the next step to include my simple c code in scilab

csum.c and csum.h that we can find in  C:\Program Files\scilab-5.3.0-beta-1\contrib\toolbox_skeleton\src\c
Thanks for all

Christian

________________________________
De : azerty azerty [mailto:end48war at yahoo.fr]
Envoyé : jeudi 22 juillet 2010 21:06
À : users at lists.scilab.org
Objet : [scilab-Users] Re : [scilab-Users] Run C code function in Scilab

Hi Christian,

As said by Michaël, you have to install a C compiler on your compiler. Under windows, you can use Microsoft Visual Express or lcc (both are free). Perhaps you could use another one through MinGW but I'm not familiar with this.

After that, ilib_for_link should work correctly.

Best regards,
Benoit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100723/c154ceaa/attachment.htm>


More information about the users mailing list