Paul,
What about the case where a user creates a local version/copy of the SDK/IDE library in his sketchbook/libraries
folder to create some local modifications?
And also suppose he re-names it something different than the original name.
Then what?
Under the current behavior, the users sketchbook/libraries library would be selected rather than
the one that shipped with the library.
I'm not sure what would happen with your patch.
i.e.
I create a library directory called "fmLiquidCrystal", under my sketchbook/libraries.
This is a library that is designed to override the LiquidCrystal library
that ships with the IDE. Inside that directory is a file called "LiquidCrystal.h"
Currently the user's local library will override the system library even though
the directory name for the library does not match the header file name.
But it sounds like this might nott work anymore.
The reason that I bring this up, is that I use the method for development & testing.
If you don't rename the local library directory when you put it into your local sketchbook/libraries
then things can get confusing as you will see the library in the list of libraries twice.
I know I'm not a typical Arduino user. But I'd ask that you consider this scenario.
In the case of local collisions, I agree that using the one with the matching directory name
should win, but I would think that a local library should still override a system library, even if the
local directory doesn't match.
So the directory match preference would only be done if there are multiple local libraries to pick from
and a local library would always be preferred over the system library even if the local library didn't
have a matching directory name.
On a related note,
one of things that I'd really like to see would be a change the include path.
Currently, the include path is based on the where the include files used in the sketch are found.
This is what is creating this very issue.
The thing I'd like to see would be to add two directories to the front of the include path:
- The path to the users sketchbook/libraries directory
- the path to the IDE libraries directory for the current board.
This would have benefits not only for sketches but also for libraries.
If these two directories were added to the path, then sketches and libraries could specify
which library to use. i.e:
#include <Wire/Wire.h>
#include <fmLiquidCrystal/LiquidCrystal.h>
etc...
This allows the sketch or library specify with certainty which library & header file
they want and not have to worry about collisions.
--- bill
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.
On 02/12/2014 10:45 PM, Bill Perry wrote:
Paul,
What about the case where a user creates a local version/copy of the SDK/IDE library in his sketchbook/libraries
folder to create some local modifications?
And also suppose he re-names it something different than the original name.
Then what?
Under the current behavior, the users sketchbook/libraries library would be selected rather than
the one that shipped with the library.
I'm not sure what would happen with your patch.
i.e.
I create a library directory called "fmLiquidCrystal", under my sketchbook/libraries.
This is a library that is designed to override the LiquidCrystal library
that ships with the IDE. Inside that directory is a file called "LiquidCrystal.h"
Currently the user's local library will override the system library even though
the directory name for the library does not match the header file name.
But it sounds like this might nott work anymore.
That's correct. If you create a copy of the library and name its directory "fmLiquidCrystal", but the .h file inside that directory is "LiquidCrystal.h", then this patch will cause the original copy which is in a directory named "LiquidCrystal" to be used.
Of course, if you also change the header file to "fmLiquidCrystal.h", then your copy will be used.
just like in every other good old object oriented language ...
/d
________________________________________
De: Vasilis Georgitzikis <tzi...@gmail.com>
Enviado: lunes, 10 de marzo de 2014 17:46
Para: Cristian Maglie; Tom Igoe
Cc: Arduino Developers
Asunto: Re: [Developers] Library conflicts
/d
________________________________________
De: Vasilis Georgitzikis <tzi...@gmail.com>
Enviado: lunes, 10 de marzo de 2014 18:20
Para: David Cuartielles
Cc: Cristian Maglie; Tom Igoe; Arduino Developers
/d
________________________________________
De: Paul Stoffregen <pa...@pjrc.com>
Enviado: lunes, 10 de marzo de 2014 19:24
Para: devel...@arduino.cc
Other points of note
I question if libraries without matching header file names should ever have been allowed! However, with this system, any remaining stray #includes can be resolved in the "old way" (after the headers that can be matched to library names (along with the child/ancillary headers) have been processed)
Regards,
Tim
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.
Just today I and others answered a forum question involving a confusing library conflict. Still nobody knows what's really wrong, but the best theory is he's got multiple conflicting copies of SD and/or SdFat maybe in the Arduino libraries folder, or his sketchbook folder, or maybe even some files copied into his sketch. On hearing advice about older versions, he may have copied SD from other Arduino versions into this copy, or his sketchbook. Like many users, he's not perfectly clear about which locations are where on his computer. He resorted to installing Arduino 1.0.5 on another computer, to discover the problem wasn't actually in his sketch, but "something messed up" on his machine. These library conflicts can be a really, really frustrating!
1.5.6 now prints info about which libraries it's really using, but only if verbose info while compiling is turned on (not the default). The info is printed early and tends to scroll out of sight.
This recent conversation about library conflicts makes me wonder if we could detect conflicts and print very helpful messages only in those troublesome cases. Really, I suppose this is 2 questions.
#1: Cristian, Tom, Massimo - How would you feel about Arduino printing a library conflict advisory message in the highly visible location right before the sketch size, even without verbose mode?
fwiw, I'm in favour of a warning either at compile time or during startup that informs the user that the #include (compile)/ .h (startup scan) is ambiguous as it matches more than one library / header file. I also like the idea of a warning that a user library may be conflicting with an arduino standard library.
Also, I thing the suggestion as to including the library folder as an additional validation as to which library the header belongs to is an excellent way to resolve the 'which foo.h' issue, whilst still maintaining compatibility with old scripts.
Regards,
Peter
#1: Cristian, Tom, Massimo - How would you feel about Arduino printing a library conflict advisory message in the highly visible location right before the sketch size, even without verbose mode?
#2: What types of conflicts should be detected and presented?
Obviously, no message should appear when every #include line matches exactly 1 library. Even if 2 libraries potentially conflict, the message should only appear if their sketch contains a #include that references the conflict. A message is probably not worthwhile if there's a conflict that's resolved by one library name matching and the other not matching the header name.
The 2 cases I'd like to see put in front of ALL Arduino users are when their sketch uses a library that's both in their sketchbook and Arduino's libraries, and the case where a #include matches to 2 libraries but it is the neither library's name. These 2 are the most serious problems that cause tremendous user confusion.
A third useful case might be when the sketch contains a .h file that happens to be the same as any .h file from any of the libraries matched. Use of .h, .c and .cpp files in sketches is rare, so perhaps this isn't worth the trouble?
A fourth controversial case might be a message when their sketch contains a #include that causes a library to be used, but no #include matching that library name was in their sketch. For example, #include <EthernetUDP.h> without #include <Ethernet.h>.
This will not be an easy or small patch, since the IDE builds a 1:1 mapping of filenames to libraries at startup. Information about conflicts is long gone when the sketch is compiled. So before working on this, since I know IDE changes visible to normal users are a big deal, I'd like to talk about whether this is something you'd accept into Arduino, and if it's welcome, how you feel it should be designed?