1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2016 - Scilab Enterprises - Paul Bignier
4// Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU
5//
6//  This file is distributed under the same license as the Scilab package.
7// =============================================================================
8//
9// <-- NO CHECK ERROR OUTPUT -->
10//
11// <-- CLI SHELL MODE -->
12//
13// <-- UNIX ONLY -->
14
15ilib_verbose(0);
16curDir = pwd();
17cd TMPDIR;
18
19fd = mopen("test_script2.sce", "wt");
20
21txt = [
22"cd TMPDIR;"
23"f2 = ["
24"""int ext2c(int *n, double *a_, double *b, double *c)"""
25"""{"""
26"""    volatile int x = 42;"""
27"""    volatile int y = 0;"""
28"""    x=x/y;"""
29"""    return 0;"""
30"""}""];"
31""
32"mputl(f2, ""fun2.c"");"
33""
34"libname = ilib_for_link(""ext2c"", ""fun2.c"", [], ""c"", [], ""loader.sce"", ""test"");"
35"refname = ""libtest"" + getdynlibext();"
36"assert_checkequal(refname, libname);"
37"exec(""loader.sce"");"
38""
39"n = 3;"
40"a = [1 2 3];"
41"b = [4 5 6];"
42"call(""ext2c"", n,1,""i"", a,2,""d"", b,3,""d"", ""out"",[1 3],4,""d"");"
43];
44
45mputl(txt, fd);
46mclose(fd);
47
48err = unix(SCI+"/bin/scilab-cli -f ""test_script2.sce""");
49if err == 0 then pause, end
50
51