| STL type |
-Header 2 |
+Scilab type |
| vector/list of int | int matrix |
| vector/list of double | double matrix |
| vector/list of string | string matrix |
@@ -887,18 +888,15 @@ In the SWIG interface file, the STL support can be enabled with:
As templates, for each specific type used, the STL container has the to be instantied:
-namespace std {
+namespace std {-->
%template(IntVector) vector;
%template(DoubleVector) vector;
-At last, a command has to be run in Scilab, so that all that types are known by Scilab.
-
-
-
+At last, the module initialization function has to be executed first in Scilab, so that all that types are known by Scilab.
+See 37.5.6 for more details.
+
37.5 Module
@@ -922,11 +920,12 @@ Usually, one module is created to bind one library. Each library to be wrapped c
37.5.2 Interface file
-To one module corresponds one interface file. Multi modules in an interface file are not supported.
+Each module needs one interface file. Multi modules in an interface file are not supported.
-Usually the interface file will look like as following:
+The module interface file begins by declaring the module name, then the wrapping declarations follow.
+It is often easier to include the whole header of libray to wrap. Then the interface file typically looks like this:
@@ -1022,6 +1021,23 @@ clear get_file_path;
fcts: vector of character strings. The name of new Scilab function implemented in the new interface.
+
37. 5.6 Module initialization
+
+
+A built-in Scilab function is generated for the wrapped module.
+This function is used to initialize the module SWIG runtime (which is necessary when working with the STL), or to import in Scilab some wrapped constants and variables.
+So it is recommanded to execute this function at first, each time the wrapped library has to be used.
+
+
+
+ The function has the name _Init() and is prefixed by the module name.
+ For example, to init the module example :
+
+
+
+
37.6 Other resources