C/C++ Question Using Project Attributes for Constants at Compile Time

JanG

Member
Licensed User
Longtime User
Is it possible to use the Project Attributes to set constant values in a c++ library (.cpp/.h) at compile time.

E.g. an array in cpp thats size is not "hard" constant, its size must be constant at compile time but you can set it for every b4r project with a different size. E.g. a buffer in a library thats size depends in the b4r project.

If it's possible, how?
 

JanG

Member
Licensed User
Longtime User
There are no preprocessor constants in B4R.
Thank you, but I think maybe my question was not clear eneough...
I need the preprocessor constants for the c++ source, for developing libraries. But I need a possibility to set this preprocessor constants in the b4r project and the values are transferred to the preprocessor before compiling this c++ code.
Example:
b4r-Code
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
    #MAX_CONNECTIONS: 4 'new, not possible at the moment
#End Region
cpp-code (library)
B4X:
unit8_t myByteArray[MAX_CONNECTIONS];

This way it's easier, because I don't have to edit the library source every time a need another buffer size.
 

JanG

Member
Licensed User
Longtime User
Great! :) Customer support 1A!!!

Just now I renewed my licence to full enterprise...
 
Top