On globals of different modules.

This is a discussion on On globals of different modules. within the C Programming forums, part of the General Programming Boards category; Hello, this is the question: when you compile different modules (.obj) and then you link them all to get the ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    106

    On globals of different modules.

    Hello, this is the question:
    when you compile different modules (.obj) and then you link them all to get the executable, how are the globals of each module allocated? Are them global variables or are them static (private) of each module, or anything else?
    Thanks a lot for answer.

  2. #2
    Compulsive Liar Robc's Avatar
    Join Date
    Jul 2004
    Posts
    149
    >Are them global variables or are them static (private) of each module, or anything else?
    It depends on how they're declared. Global variables as they're commonly called have static storage duration, but they can have either external or internal linkage depending on whether the declaration is qualified with static or extern or nothing. If a variable has internal linkage, it's only visible within the file in which it was declared. If it has external linkage then it's visible to other files.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. Sugguestion on choosing my modules
    By ssharish2005 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-27-2007, 05:44 PM
  3. Multiple Modules
    By rwmarsh in forum C++ Programming
    Replies: 6
    Last Post: 02-18-2006, 03:34 PM
  4. Problems with modules
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 8
    Last Post: 07-29-2005, 08:56 PM
  5. globals & multiple .c files
    By Unregistered in forum C Programming
    Replies: 8
    Last Post: 10-30-2002, 08:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21