Tweaking libraries and navigation of them

First, I don't intend to actually tweak a library as I'm sure that's very poor form.

Second, I am new to C++. I understand the basic structure (classes, structures, libraries etc), but I'm not familiar with all the classes and the libraries where they can be found.

Take any hypothetical library example sketch. Say there is something in the code you'd like to tweak in the example sketch, only you discover the code isn't in the example sketch. You must begin back tracing through a myriad of libraries to find whatever it is you're looking for.

So, the first step I imagine is to find an object being instantiated:

Watsit myVar(3, 56, "John Smith");

Second, take a look at the #included libraries at the top of the sketch. Pick the one where you "think" you'll find the "Watsit" class. Sometimes it's obvious. The class is in the obvious cpp file and you can write your own library or, wrapper, or whatever based on the class construct you tracked down.

But, it's rarely that easy, right? I mean, I find that it becomes so convoluted sometimes I can't keep track of which file includes which file which points to this one which uses an alias of another one. It also doesn't help that functions can essentially be located almost anywhere away from the class/structure declarations.

Using a word processor to search is hard as the keywords aren't highlighted. I'm using the "find" or "search" for text but what I find is often ambiguous. Sometimes, it even seems like classes are cross referencing one another (which I highly doubt). That's just the impression I get I'm so lost.

So, any advice to make back tracking through the libraries would be much welcomed.

I have an old version of MS Visual Studio which is what I'm using to open files. It would help if I could set all these libraries and files scattered all across the computer (Program Files/arduino, User/arduino, ???, etc) up into actual MS VS projects. Is that possible? I've only used VS to create projects with my own code.

chipwitch:
First, I don't intend to actually tweak a library as I'm sure that's very poor form.

Why? I do it all the time. The really good ones don't need any tweaking.

I am having trouble getting the gist of your verbose posting. It seems like you're basically asking where the libraries are. There are built in libraries in the IDE install folder, and user libraries in the "libraries" folder in your sketch folder. Each library lives in a self-named folder there. If you open up those files, you can see the class definitions and code.

This talk of "scattered classes" makes no sense to me. If you include a library, you can open the folder and read the files, just like the compiler does. If you have a mess of cross referenced functions that you can't understand, either the code is a mess, or you are not competent to follow it. A VS project or something like that won't help in such cases.

aarg:
This talk of "scattered classes" makes no sense to me. If you include a library, you can open the folder and read the files, just like the compiler does. If you have a mess of cross referenced functions that you can't understand, either the code is a mess, or you are not competent to follow it. A VS project or something like that won't help in such cases.

That's a bit abrasive, don't you think? If I were "competent" I probably wouldn't be here asking questions. But, then again, "competent" is relative.

There are libraries in the core, libraries in the public user area, libraries I install in my own documents folder... all places set up by the windows installer. I didn't say the functions were cross referenced, I said they "SEEM" that way... Because as a noobie... I am incompetent. That should be self-evident. I'll stop now lest I become too verbose.

If you had a specific question, it would be easier to help. You didn't actually give an example of anything that is convoluted.

I thought it was pretty clear...

What process do you use when trying to track down the origin of a class. Trying to follow the daisy chain from one library to the next requires some process or knowledge of which I am not in possession. I know the principles, but in practice it's generally more complex than simply searching an included header file listed at the top of the sketch. The ones that are that simple, I can do just fine.

I can't explain it any better than that. "Backtracking" through a chain of libraries, following a bread crumb trail, reverse engineering... Many of these crumb trails should lead back to the core libraries.... the "process" I'm trying to learn would lead me there. Usually, by the 2nd or 3rd library deep, I lose the trail. Hope that's not too wordy.

chipwitch:
I thought it was pretty clear...

What process do you use when trying to track down the origin of a class. Trying to follow the daisy chain from one library to the next requires some process or knowledge of which I am not in possession. I know the principles, but in practice it's generally more complex than simply searching an included header file listed at the top of the sketch. The ones that are that simple, I can do just fine.

I can't explain it any better than that. "Backtracking" through a chain of libraries, following a bread crumb trail, reverse engineering... Many of these crumb trails should lead back to the core libraries.... the "process" I'm trying to learn would lead me there. Usually, by the 2nd or 3rd library deep, I lose the trail. Hope that's not too wordy.

A #include will take you to a *.h file which has the prototypes. You will find the *.cpp file in the same place. If there are classes and functions nested inside those, you can follow them down exactly the same way.

The only catch is the libraries that the IDE adds by default. But those are well documented. You should not usually need to go to the source to figure out how to use them.

Again, you have not given any example. I've been doing this for over a year, and I've never had to "backtrack" or hunt through anything that was nested that deeply. Are there some special libraries that you've obtained and are examining?

But, it's rarely that easy, right?

It should be. Libraries that use one name for the class and something completely different for the file name usually get bashed pretty thoroughly here, so people tend to not make that mistake, or to not persist it, if they want people to use the libraries that they built.

Because as a noobie... I am incompetent. That should be self-evident.

I wasn't going to comment on this, but... Newbies really should accept that they can't know it all from day 1. And, as a newbie, you should not be mucking in libraries that you don't understand.

If you have a SPECIFIC issue with a SPECIFIC library, we can help you understand the way it is structured, what ir depends on, etc., so that you can resolve the issue or at least understand why it is biting you in the butt.

PaulS:
I wasn't going to comment on this, but... Newbies really should accept that they can't know it all from day 1. And, as a newbie, you should not be mucking in libraries that you don't understand.

So, what about what I said made you reply in this manner? I know I'm a newb. I know I'm incompetent. I don't expect to know it from "day one." I've said as much.

Reading code is one of the best ways to learn it. You'll find that little gem repeated all over the net. I didn't realize that reading libraries was "mucking" around. I'm not the one who said it's acceptable to alter libraries. But, if I did find something in a library I wanted to tweak, I'd make a copy of the library and make my own, if I couldn't find a way to access it from within the sketch directly.

So, I strongly disagree with you if you think I shouldn't be "mucking" around in libraries. While programming in C++ is somewhat new to me, I've been programming many other languages starting in '82 on a TRS-80, including a little bit of C in 93 or there about. Admittedly, the whole memory allocation thing is foreign to me.

If you have a SPECIFIC issue with a SPECIFIC library, we can help you understand the way it is structured, what ir depends on, etc., so that you can resolve the issue or at least understand why it is biting you in the butt.

I don't have a specific issue with a specific library. I've noticed this in several libraries I've perused.

I really appreciate the help I get here. I'm glad Arduino exists otherwise I'd probably have never bothered with C++. Their whole mission of it being a beginner platform to introduce people to programming is a noble one. I hope that spirit continues.