I'm porting the Arduino framework on a NIOS II system which, depending on configuration (normal/small C library), may have or not have atof()
function available. Naturally, String::toDouble()
which is implemented using atof()
cannot always be there either. However, I would still like to make it available for users with normal C library. Desired behavior:
- small C library, user doesn't call
String::toDouble()
- the framework should compile - small C library, user calls
String::toDouble()
- the framework should fail to compile - normal C library user doesn't call
String::toDouble()
- the framework should compile - normal C library, user calls
String::toDouble()
- the framework should compile
How could I implement this? The choice between normal/small C library is implemented as a command line option for the linker, and as far as I can tell, no macro defining the choice is available to the application at compile time.
Current NIOS toolchain is based on GCC 5.3.0, but older devices are only supported by the old toolchain based on GCC 4.7.3. I would prefer a solution which would work on both.