B4R Question Anything like #define

canalrun

Well-Known Member
Licensed User
In C there is a way to define text replacement constants:
#define Size 64

any place Size appears it is replaced by 64

This is handy. I have a dozen arrays, all with Size or Size / 2 elements.

I see "DefineExtra:" but it does not seem to do what I think, or I'm doing something wrong. I am using B4A ver 2.51.

B4X:
#Region Project Attributes
  #AutoFlushLogs: True
  #CheckArrayBounds: True
  #StackBufferSize: 500
  #DefineExtra: #define FFT_N 64
#End Region

Sub Process_Globals
  Public Serial1 As Serial
  Public wemos As D1Pins

  Private pinD3 As Pin ' inp pin for the button
  Private pinLED As Pin  ' outp pin for LED on the WeMos

  Dim d1r(FFT_N) As Int ' <--- This shows as a warning (#8)
  Dim d1i(64) As Int ' <--- This is good
End Sub

Is there a way to define a constant then use that to specify Process Global arrays?

Barry.
 
Top