Hi all,
I know that accessing a global variable or a flowcode macro in a C icon the prefix FCV or FCM is used however searching the wiki I found no reference to acessing a local variable such as ".myvariable"
Is this in anyway possible Thanks for helping out
Accessing local variable in C Icon
- p.erasmus
- Posts: 434
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 12:01 pm
- Location: Russia / Россия
- Has thanked: 104 times
- Been thanked: 88 times
-
- Valued Contributor
- Posts: 988
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 106 times
- Been thanked: 517 times
Re: Accessing local variable in C Icon
FCL_VARIABLENAME
It's also possible to use macros - FCM_MacroName (params..); - Note that the macro's name isn't capitalised whereas variable names are.
Martin
It's also possible to use macros - FCM_MacroName (params..); - Note that the macro's name isn't capitalised whereas variable names are.
Martin
- p.erasmus
- Posts: 434
- Joined: Thu Dec 03, 2020 12:01 pm
- Location: Russia / Россия
- Has thanked: 104 times
- Been thanked: 88 times
Re: Accessing local variable in C Icon
Thanks Martin
apprecaite your help !
another questiuon is there away to make alocal variable static in FC i.a.w that it retains its value when going out of the macro and when retuning to it ?
apprecaite your help !
another questiuon is there away to make alocal variable static in FC i.a.w that it retains its value when going out of the macro and when retuning to it ?
Regards Peter - QME Electronics
-
- Valued Contributor
- Posts: 988
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 106 times
- Been thanked: 517 times
Re: Accessing local variable in C Icon
Probably that would require a cheat....
Declare the variable in a C block and then assign to a local - and at the end of the macro 're-assign to the 'static'
Start of macro:
Then end of macro:
Martin
Declare the variable in a C block and then assign to a local - and at the end of the macro 're-assign to the 'static'
Start of macro:
Code: Select all
static int x = 1;
FCL_VAR = x;
Code: Select all
x = FCL_VAR: