Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Functions > whereis


Returns the name of the loaded library/module a given function belongs to


libmod = whereis(function)



Name (text) or handle of a Scilab "macro" or builtin function. Both kinds of input are equivalent.


If function points to

  • a function written in Scilab language and registered with genlib in some loaded library: libmod returns the name of the library.
  • an unregistered user-defined function written in Scilab language: libmod returns "script".
  • a builtin function (so-called Scilab primitive): the name of the module the function belongs to is returned.
  • Otherwise: libmod returns [].


whereis allows to identify the library of Scilab macros or the module a given function belongs to.

When the function is

a "macro" (written in Scilab language and compiled):

it may be not loaded (not yet called), but its library must be so.

When the same function name is registered in several loaded libraries of macros, whereis returns the name of all of them.

libraryinfo(..) allows to retrieve the path to definition files of a library.

  • Since Scilab 6.0: When, in the mymacro.sci file defining a public macro mymacro() registered in a library, some additional functions are defined after mymacro(), these additional functions are NOT registered in the library. So, whereis ignores them and will return [] for them. See the Examples section.
  • When a module like xcos has sublibraries, these ones are often loaded in Scilab only after the first call to the main function (like xcos()). As a consequence, whereis(..) querried for a function of such a sublibrary will return [], until the main function -- like xcos() -- is called a first time. See the Examples section.

a user-defined function registered in no library

but defined

  • directly in the console by deff(..) or by function ... endfunction, or
  • in a file loaded in the Scilab session with exec(functionfile.sci) or with getd(..),

whereis returns "script". When this function is defined in a file, there is no way to retrieve the file path and name.

a builtin written and compiled in an external language (C, C++..):

whereis returns the name of the module the function belongs to. More precisely, the name of the "gateway" is returned. It matches the module's name for all cases except for action_binding_gw, functions_gw, matio_gw, signal_processing_gw, statistics_gw, for which "_gw" is appended to the module name.

The gateway file is located at SCI/modules/moduleName/gateway/moduleName_gateway.xml, where moduleName must be replaced with the actual module name.

In the case that the function name is simultaneously defined as a unregistered function ("script"), and as a registered one in a library and as a builtin, whereis returns only one kind of answer with the likely priorities: builtin's module > macro's library > "script" for unregistered macro. However, the actual result may vary (and be []).


// Case of an unregistered macro:
function myTest(), disp("Unregistered function"), endfunction
whereis("myTest")               // => "script"

// Case of a registered macro:
r = whereis("ls")               // => "fileiolib"
[?,path]= libraryinfo(r); path  // => "SCI\modules\fileio\macros\"

// Let's define another ls() in another library:
path = TMPDIR+"/myls";
mputl("function ls(), disp(""my other ls() in lslib""), endfunction", path+"/ls.sci");
genlib("lslib", path);
whereis ls                      // => ["fileiolib"; "lslib"]

// Case of a builtin function
whereis sin                     // => "elementary_functions"
whereis conv2                   // => "signal_processing_gw"

// Case of an unregistered macro defined/loaded after a registered one:
clear ls lslib
whereis ls                      // "fileiolib" : OK
function ls(),  disp("my local ls()"), endfunction
ls                              // => "my local ls()"
whereis ls                      // => "fileiolib", still
clear ls                        // (cleaning up)

// Dependencies are ignored:
// chfact() has some private dependency functions blkfc1(), inpnv(), etc:
edit chfact
// chfact() is registered:
whereis chfact                  // => "sparselib"
// .. but not its dependencies:
whereis blkfc1                  // => []

// Sublibraries may be loaded only after the first call to a main driving function:
// CLR() is a public function related to the CLR Xcos block belonging to the
//  Linear palette and declared in the Linearlib library.
// But this sublibrary is loaded only after a first call to xcos():
whereis xcos         // => "xcoslib"
whereis CLR          // => [], if you never called xcos() in the session yet.
xcos()               // => loads all its sublibraries. Please ignore the interfaces.
                     //    You may even close them.
whereis CLR          // => "Linearlib" non-empty answer, now

See also

  • genlib — 指定したディレクトリの関数からライブラリを構築する
  • libraryinfo — マクロとscilabライブラリのパスを取得
  • lib — ライブラリ定義
  • getmodules — Scilabにインストールされているモジュールの一覧を返す


  • whereis now supports builtin functions.
  • When the same function name is registered in several libraries, whereis now returns all of them instead of only the last loaded one.
  • For unregistered user-defined macros, whereis now returns "script" instead of [].
Report an issue
<< varargout Functions Development tools >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 23:12:44 CET 2018