It's very possible that there are different libraries with the same name, written by diferent authors for similar but not necessarily identical purposes. It's likely that there are lots of libraries called Time for example, or Timer, or whatever.
If I get hold of a library but it has the same name as one I already have installed, what do I have to change if I want the new one to be jimTimer and keep the original as Timer, say? I'm doubt it's not as simple as changing the folder names and those of the .cpp and .h files. Is there anything under the hood? And if so, is it safe just to do a general find / replace and change Timer (or whatever) to jimTimer?
JimboZA:
I'm doubt it's not as simple as changing the folder names and those of the .cpp and .h files.
Uh ... well ... you should have gone with your first instinct. The process is not much more difficult.
Is there anything under the hood?
The dot-cpp file(s) include the dot-h file(s). The #include line(s) has (have) to be updated with the new filename.
I suspect the keyword.txt file has to be updated with the new filename(s) as well but that is optional.
Oh, and you will have to restart the IDE after the changes.
Thanks- since I posted I experimented, and went with changing the folder name, the cpp and h file names and the include in the cpp. For good measure I did a replace-all in both files.
Changed my sketch to call the new library, and it compiles error-free. Not tested it yet.
So yep it does seem very simple!
JimboZA:
For good measure I did a replace-all in both files.
But I realise that could have caused a problem, since the name of the library is also usually the name of the class inside I think. In my case I lucked onto experimenting with Bounce2, and the names inside are just Bounce not Bounce2 so I didn't do bad.
JimboZA:
But I realise that could have caused a problem, since the name of the library is also usually the name of the class inside I think.
That is only a problem if you include both libraries in one sketch. A problem easily be resolved by putting the libraries into separate namespaces.
Which brings up the VMS naming method. Everything is prefixed with three (or fewer but never zero) letters that indicate the sub-system. In the Arduino world, the author's initials would be an excellent choice. For example, libraries you author could be prefixed with "jza". For Tiny Core 2 everything internal is prefixed with "tc".