J JanG Member Licensed User Longtime User Feb 10, 2017 #1 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?
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?
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2017 #2 There are no preprocessor constants in B4R. You can do something like: Code: #If LargeBuffer Private Buffer(500) As Byte #Else Private Buffer(100) As Byte #End If
There are no preprocessor constants in B4R. You can do something like: Code: #If LargeBuffer Private Buffer(500) As Byte #Else Private Buffer(100) As Byte #End If
J JanG Member Licensed User Longtime User Feb 12, 2017 #3 Erel said: There are no preprocessor constants in B4R. Click to expand... 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 Code: #Region Project Attributes #AutoFlushLogs: True #CheckArrayBounds: True #StackBufferSize: 300 #MAX_CONNECTIONS: 4 'new, not possible at the moment #End Region cpp-code (library) Code: 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.
Erel said: There are no preprocessor constants in B4R. Click to expand... 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 Code: #Region Project Attributes #AutoFlushLogs: True #CheckArrayBounds: True #StackBufferSize: 300 #MAX_CONNECTIONS: 4 'new, not possible at the moment #End Region cpp-code (library) Code: 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.
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2017 #4 I see. It will be possible in the next version of B4R.
J JanG Member Licensed User Longtime User Feb 12, 2017 #5 Great! Customer support 1A!!! Just now I renewed my licence to full enterprise...