return
end
- cmd='';
+ cmd = "";
+ tbxFlag = " -D__SCILAB_TOOLBOX__ ";
+ envFlag = "";
+ if getenv('__USE_DEPRECATED_STACK_FUNCTIONS__', 'NO') == "YES" then
+ envFlag = " -D__USE_DEPRECATED_STACK_FUNCTIONS__ ";
+ end
+
// CFLAGS
if cflags <> '' then
- cmd = cmd +" CFLAGS=""-D__SCILAB_TOOLBOX__ "+cflags+""""
+ cmd = cmd + " CFLAGS="""+tbxFlag+envFlag+cflags+""""
end
// CXXFLAGS ... use the same as C
if cflags <> '' then
- cmd = cmd +" CXXFLAGS=""-D__SCILAB_TOOLBOX__ "+cflags+""""
+ cmd = cmd +" CXXFLAGS="""+tbxFlag+envFlag+cflags+""""
end
// LDFLAGS
end
if ierr <> 0 then
- mprintf(gettext("%s: An error occurred during the compilation:\n"),"ilib_compile");
- lines(0);
- disp(stderr);
- mprintf("\n");
- mprintf(gettext("%s: The command was:\n"),"ilib_compile");
- mprintf(cmd);
- mprintf("\n");
+ errMsg = sprintf(gettext("%s: An error occurred during the compilation:\n"), "ilib_compile");
+ errMsg = [errMsg ; stderr];
+ errMsg = [errMsg ; sprintf(gettext("%s: The command was:\n"), "ilib_compile")];
+ errMsg = [errMsg ; cmd];
chdir(oldPath); // Go back to the working dir
+ error(errMsg);
return ;
end
libname = 'lib' + libname;
end
+ if getenv('__USE_DEPRECATED_STACK_FUNCTIONS__', 'NO') == "YES" then
+ cflags = cflags + " -D__USE_DEPRECATED_STACK_FUNCTIONS__";
+ end
+
ilib_gen_Make_win32(name, tables, files, libs, libname, Makename, with_gateway, ldflags, cflags, fflags)
endfunction
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- JVM NOT MANDATORY -->
+// <-- NO CHECK REF -->
+//
+ilib_verbose(0);
+
+if getos() == 'Windows' then
+ TMP_OS_DIR = getenv('TMP','err');
+ assert_checkfalse(TMP_OS_DIR == 'err');
+else
+ TMP_OS_DIR = '/tmp';
+ assert_checkequal(isdir(TMP_OS_DIR), %t);
+end
+
+TMP_DIR = TMP_OS_DIR+filesep()+'link';
+
+rmdir(TMP_DIR,'s');
+mkdir(TMP_OS_DIR,'link');
+
+assert_checkequal(isdir(TMP_DIR), %t);
+
+//Example of the use of ilib_for_link with a simple C code
+ f1=['#include <math.h>'; ..
+ '#include ""stack-c.h""'; ..
+ 'void fooc(double c[],double a[], double *b,int *m,int *n)'; ..
+ '{'; ..
+ ' int i;'; ..
+ ' for ( i =0 ; i < (*m)*(*n) ; i++) '; ..
+ ' c[i] = sin(a[i]) + *b; '; ..
+ '}'];
+
+mputl(f1, TMP_DIR + filesep() + 'test_flag_deprecated.c');
+
+cur_dir = pwd();
+chdir(TMP_DIR);
+
+
+setenv('__USE_DEPRECATED_STACK_FUNCTIONS__', 'NO');
+ierr = execstr("ilib_for_link(''deprecated'', ''test_flag_deprecated.c'', [], ""c"");", "errcatch");
+assert_checkequal(ierr, 10000);
+
+setenv('__USE_DEPRECATED_STACK_FUNCTIONS__', 'YES');
+ierr = execstr("ilib_for_link(''deprecated'', ''test_flag_deprecated.c'', [], ""c"");", "errcatch");
+assert_checkequal(ierr, 0);