Go Down

Topic: Multiple independent libraries? (Read 535 times) previous topic - next topic


So, if I want to keep a library local to the code (say I adjusted BUFFER_SIZE in twi.h and BUFFER_LENGTH in Wire.h because whoo-eee, they were using ~10% of the 328's ram in buffers if I'm reading the object dump correctly), is there a convenient way to have the compiler _only_ use the library defined in the #include, without descending into the standard libpath?  Right now if I do something like copy Wire.h local to the sketch and

#include "Wire.h"


#include <Wire.h>

The compiler seizes up on duplicate object definitions & other similar complaints because Wire.h is in the libpath twice, I imagine.

More generally I find myself having libraries scattered around with my code because more often than not I end up tweaking one thing or another and I can't generalize it out.  Jimmie Rodger's Charliplexing library, for example.  Every array ends up needing a different ledMap, so Charliplexing.cpp and Charliplexing.h end up duplicated in every single source directory which is messy and hard to maintain at best.

At worst, since I trimmed the HardwareSerial buffers to free up space for my current project (memory is at a bit of a premium), some sketches like ArduinoISP just mysteriously fail to work until I remember my edit and revert it for ArduinoISP.  If I could duplicate HardwareSerial and keep the changes local to the sketch that depends on smaller buffers while other sketches used the system default, I'd be in heaven.

Or does this end up being one of those things that ends up forcing a transition from the Arduino environment and into a more traditional Makefile/compiler/linker process?

I've looked around http://www.arduino.cc/en/Hacking/BuildProcess and it basically confirms what I'm experiencing.  Ultimately, I guess the question is whether there's any way to declare the libraries that reside with the sketch to be the official ones (for that sketch, obviously), and to ignore everything in the outlying path?

Go Up