2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2009 - DIGITEO - Allan CORNET
5 // This file is distributed under the same license as the Scilab package.
8 if haveacompiler() then
10 // CALLING EXTERNAL FORTRAN SUBROUTINE
12 foof = [' subroutine foof(a,b,c)';
13 ' double precision a,b,c';
18 mprintf(gettext('Fortran subroutine to call in scilab.\n'));
22 // we use TMPDIR for compilation
24 if ~c_link('foof') then
30 mprintf(gettext('Call ilib_for_link to build fortran subroutine.\n'));
32 ilib_for_link(['foof'],'foof.f',[],"f");
37 //Z = X+Y by fortran subroutine
42 mprintf(gettext('Call Fortran subroutine. Z = X+Y'));
44 mprintf(gettext('with X = %d'), X);
46 mprintf(gettext('with Y = %d'), Y);
48 mprintf("Z = call(''foof'', X, 1, ''d'', Y, 2, ''d'', ''out'', [1,1], 3, ''d'');");
50 Z = call('foof', X, 1, 'd', Y, 2, 'd', 'out', [1,1], 3, 'd');
51 mprintf(gettext('result Z = %d'), Z);