[Scilab-Dev] Share variable between Xcos Blocks

Serge Steer Serge.Steer at inria.fr
Mon May 19 14:15:27 CEST 2014


Le 16/05/2014 22:06, Paul Martin a écrit :
> Hi,
>
> I have created my own Xcos Block.
> I try to share variable between them without any link.
>
> I want to have the same behavior than the GOTO/FROM Blocks, but i want to
> manage the variable inside my own block.
> My blocks are developped in C, i thought use the globlal variable, but i
> dont know how to use it in C files.
First, it is not a good idea to share variables between blocks because 
it may create side effects in particular if you want to share variables 
that can be modified by block execution (like input or output)

Nevertheless, if you really want to do that you could have  a look to 
the modules/scicos/src/c/import.c file (see the attached one if you dont 
have a source version)

The scicos_imp structure is available at simulation time and can be used 
to access to all C variables and data structures concerning the compiled 
model like global continuous state scicos_imp.x, all blocks inputs ans 
outputs,... as well as the array of blocks definition scicos_imp.blocks.

Serge Steer



> Thanks,
>
> Paul
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Share-variable-between-Xcos-Blocks-tp4030517.html
> Sent from the Scilab developers - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20140519/cccc60a5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: import.c
Type: text/x-csrc
Size: 32052 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/dev/attachments/20140519/cccc60a5/attachment.bin>


More information about the dev mailing list