Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/30/05 19:51
Read: times


 
#103147 - Nothing to do with SDCC
Responding to: ???'s previous message
Mahesh Vyas said:
We are not clear despite reading SDCC manual, how to access the variables defined in master C file from another C file

This has nothing specifically to do with SDCC - it is standard 'C' language stuff. You need a 'C' textbook.

Normally, Compiler manuals concentrate on the specifics of the particular compiler - they assume that you already know how to program in 'C'.
Compiler manuals are not 'C' textbooks.

Each variable must be defined exactly once.
The conventional approach is to have variable definitions in .c files, and provide 'extern' declarations in .h "header" files.
Then, any other .c file requiring access to the variable just #includes the appropriate .h "header" file.

List of 12 messages in thread
TopicAuthorDate
Using Multiple C files in SDCC            01/01/70 00:00      
   Not about the compiler            01/01/70 00:00      
   Nothing to do with SDCC            01/01/70 00:00      
   The joy of C            01/01/70 00:00      
      Sloppy terminology            01/01/70 00:00      
         Using Multiple C files in SDCC            01/01/70 00:00      
            Laziness            01/01/70 00:00      
            example            01/01/70 00:00      
   globals are generally bad ...            01/01/70 00:00      
      "Generally" being the important word!            01/01/70 00:00      
         re Globals            01/01/70 00:00      
      static            01/01/70 00:00      

Back to Subject List