[scilab-Users] function link and Fortran codes

Allan CORNET allan.cornet at scilab.org
Fri Dec 17 08:00:04 CET 2010


Hi,

 

A example to build and call a fortran 90 code :

 

 

    sourcecode=['subroutine incrdoublef90(x,y)'

                '  implicit none'

                '  double precision, intent(in) :: x'

                '  double precision, intent(out) :: y'

                '  y=x+1'

                'end subroutine incrdoublef90'];

    cd(TMPDIR);

    mputl(sourcecode,'incrdoublef90.f90');

    libpath=ilib_for_link('incrdoublef90','incrdoublef90.f90',[],'f');

    exec('loader.sce');

    n = 1.;

    m = call("incrdoublef90",n,1,"d","out",[1,1],2,"d");

 

-->    libpath=ilib_for_link('incrdoublef90','incrdoublef90.f90',[],'f');

   Generate a loader file

   Generate a Makefile

   Running the Makefile

   Compilation of incrdoublef90.f90

   Building shared library (be patient)

   Generate a cleaner file

-->    exec('loader.sce');

Shared archive loaded.

Link done.

-->    n = 1.;

-->    m = call("incrdoublef90",n,1,"d","out",[1,1],2,"d");

-->m

m  =

    2.  

 

 

 

Allan

 

De : Pedro Ledoux [mailto:p_ledoux at yahoo.com.br] 
Envoyé : vendredi 17 décembre 2010 05:11
À : users at lists.scilab.org
Objet : [scilab-Users] function link and Fortran codes

 

Was told me that with this function, I'd be able to call C or Fortran
functions in scilab and use then. So with function load it would be
possible. I tried to do it for a simple Fortran code:

SUBROUTINE sci(n,v)
 integer :: n
 real,dimension(n) :: v
 v=sin(v)



END SUBROUTINE sci

When I tried to use link comand:

Um erro ocorreu: funt.o: Apenas ET_DYN e ET_EXEC podem ser carregados
                           !--error 236 
link: O arquivo compartilhado não foi carregado: (null)
 
 translating:

An error ocurred: funt.o: Only ET DYB and  ET EXEC can be loaded.
link: The shared file wasn't loaded:(null)

So what would it be?





 


 

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


More information about the users mailing list