Where is the source with the floating point functions in. I tried this one http://forum.arduino.cc/index.php?topic=227351.0 but you must have a newer version.EDIT: found the 0.72 version, no luck there either.
Libraries are not slaves to the user of the library.The library code is compiled separately and the behavior you are seeing isthe expected behavior. This is how libraries work.
#define ENTROPY_FLOAT#include <Entropy.h>
The Arduino build methodology is not all that smart and does not save things like the compiled librariesfor re-use across different sketches. However, in the Arduno environment, even though the librariesare not being saved for other sketches to use, the libraries are still actual libraries andsince a library is a separate entity from the code that uses it, there is no way to do what you are wanting.--- bill
the simplest solution I can think of is to provide two libraries but that is a burden for the developer.Another way is to use a templates. A very short intro see - http://www.cplusplus.com/doc/tutorial/templates/ - at the end of the pageor- http://www.tutorialspoint.com/cplusplus/cpp_templates.htm -
#ifndef ENTROPY_FLOAT #ifdef ENTROPY_FLOAT_COMPILE #define ENTROPY_FLOAT //Include for compilation, sketch must define to use. #endif#endif
#include <Arduino.h>#define ENTROPY_FLOAT_COMPILE#include <Entropy.h>
Quote from: bperrybap on Apr 16, 2014, 09:18 pmLibraries are not slaves to the user of the library.The library code is compiled separately and the behavior you are seeing isthe expected behavior. This is how libraries work.Yes, and if the Arduino environment was actually using libraries I would understand that I would have to use a different method to get around the problem, for instance letting a define specify which vesion of the library to link into the code; however, as you point out below, the Arduino libaries are not really libraries, but module of code that get included in the compile process.As such something simply like would be nice.Code: [Select]#define ENTROPY_FLOAT#include <Entropy.h>
All the other Arduino libraries like your Entropy library are still being treated like a library by the IDE.The IDE doesn't create a library .a archive file for it but otherwise the library is being handledvery similar to a "normal" library.The files in the library are each compiled separately from the users code (sketch files) and then then the library objects are linked in with the users code.(The library files are not included or merged into the same compilation unit as the users sketch)The only difference between "real" libraries and what the IDE is doingis that with the exception of the Arduino core library, the compiled objects in the other librariesare not archived into a .a archive file before they are linked in.--- bill
Yeh, this library works even on some of the small tiny avr's (2313), but only if none of the code for floating point is included since that brings in additional 'library' code that really bulks up an application. However, for some applications, and on the appropriate chips, floating point random numbers can be very useful, so I want to include the capability in the library, but only if the user needs it...I thought if you used some of a classes code, then all of it were included.
No overhead for unused data. To achieve what you want, no mods are needed.
the Arduino libaries are not really libraries, but module of code that get included in the compile process.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16