Utils.bas included in LCD.bas - which one does it use?

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
matherp
Registered User
Registered User
Posts: 31
Joined: Tue May 31, 2011 2:59 pm
Location: Cambridge

Utils.bas included in LCD.bas - which one does it use?

Post by matherp » Fri Jun 10, 2011 3:58 pm

Hi

I've just received my full version of SF and am continuing to get to grips with it.

One question relating to Jerry's recent post of SetAllDigital.

I've included this in a copy of utils.bas in my UserLibrary directory. LCD.bas includes utils.bas and calls SetAllDigital. If I browse to this in the Code explorer I get the original copy in the central library not my one.

Which one will the compiler use and can I get round this without also creating a user version of all modules?

Thanks

Peter

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Fri Jun 10, 2011 5:00 pm

You have to understand that the Swordfish Explorer window and compiler looks for include files in the following way:

(1) current directory
(2) user library
(3) library

if LCD.bas is the currently selected module in the IDE, it will pull "utils.bas" from "library" - as this is where LCD is located.

Now, lets assume you have "my_program" loaded - in your explorer window the following

Code: Select all

Includes
   USART
   LCD
      Includes
          SYSTEM
          UTILS
Then clicking on "Utils" in the explorer window pulls "utils" from the user library. That's because the search has started in the folder that contains "my_program"

So, to answer your question, when compiling "utils" will be pulled from "user library" not "library". Using the explorer window is really useful sometimes to see this kind of thing. By the way, don't forget to have "Explorer Includes" enabled from the explorer window drop down to force the IDE to traverse all includes. On larger programs you may want to disable this feature, but useful to highlight the points above.

Post Reply