bcc
bcc copied to clipboard
Allow BlitzMax variables in native code
Currently, native code (inline C) can't directly interact with BlitzMax code, because we don't have a way to refer to BlitzMax variables within the native statements.
We can't use variable as-is in the native code, because the actual generated variable names are different. So, for example, we can't do this :
SuperStrict
Framework BRL.Standardio
Local a:Int = 10
'! printf("a = %d\n", a);
Print "a = " + a
because a
in the native section is an unknown variable.
We may be able to prefix the variable in the native code, parse it, and check it during the semanting phase.
The @
symbol seems a reasonable choice as it is not used in C.
So we could end up with something like :
SuperStrict
Framework BRL.Standardio
Local a:Int = 10
'! printf("a = %d\n", @a);
Print "a = " + a
where @a
would be replaced by the correct variable name during generation.