[Contents] [TitleIndex] [WordIndex

Call a Java object from Scilab (developer perspective)

Please note this applies only to Scilab >= 5.0. This is a draft.

  1. Create the gateway and update all files to add the new Scilab function (modules/xxx/sci_gateway/gw_xxx.xml modules/xxx/sci_gateway/c/gw_xxx.c modules/xxx/includes/gw_xxx.h)

  2. Watch your Java classes and think what and how you want to plug it to Scilab. Note that only primitive types and string (and all of them in Array) can be managed (please note that this may change in the future). For example, if a method expects a vector of integer, you will need to create a new Java Class which will convert the input (probably an array of integer) into a vector.
  3. Write your gateway code. Check the number of input argument, their type and size.
  4. Write the XML file describing the method you want to map.

    More information on: http://www.scilab.org/giws/

  5. Generate the C++ (.cxx & .hxx) wrapper thanks to GIWS with the XML wrote at point 4

  6. In your gateway (store in sci_gateway/cpp), access to the feature using the C++ wrapper.

    Note that you will need to use the directive extern "C" { xxx } to avoid the C++ name mangling.

2022-09-08 09:26