Difference between revisions of "COMMON"

From QB64 Wiki
Jump to navigation Jump to search
imported>Cyperium
imported>Clippy
Line 1: Line 1:
'''COMMON''' makes the variables available to a different module.
+
'''COMMON''' shares common variable values with other Linked or [[CHAIN]]ed modules.
  
  
''Syntax:'' COMMON [SHARED] [/blockname/] variablelist  
+
::::::''Syntax:'' COMMON [SHARED] [/blockname/] variablelist  
  
  
 +
* COMMON must be called before any executable statements.
  
[[SHARED]] makes the variables shared within the subs and functions within that module.
+
* [[SHARED]] makes the variables shared within [[SUB]] and [[FUNCTION]] procedures within that module.
  
 +
* /blockname/ gives the ability to name a block of variables (ex. COMMON /thename/ a, b, c), this name can later be referenced in the module to only give access to those variables. As such many COMMON statements can be issued with different names to be shared in different modules.
  
/blockname/ gives the ability to name a block of variables (ex. COMMON /thename/ a, b, c), this name can later be referenced in the module to only give access to those variables. As such many COMMON statements can be issued with different names to be shared in different modules.
+
* Variablelist is the list of common variables made available separated by commas.
  
 +
* Remember to keep the variable type ''order'' the same in both modules as it is the order that matters and not the variables names.
  
variablelist is the variables that should be made available separated by commas.
+
* [[COMMON SHARED]] is most commonly used (hence you almost always see them together in code), as then you don't need to share the variables seperately in the module for use in subs and functions of that module.
  
 +
* Common variables can only be passed by [[CHAIN]] using compiled modules if BRUN45.EXE is included with the program.
  
Remember to keep the variable ''order'' the same in both modules as it is the order that matters and not the variables names.
+
* Linked files are compiled first and linked with LINK.EXE in QB. '''QB64''' cannot link files presently!
  
  
COMMON must be called before any executable statements.
 
  
  
[[COMMON SHARED]] is most commonly used (hence you almost always see them together in code), as then you don't need to share the variables seperately in the module for use in subs and functions of that module.
+
''See:'' [[COMMON SHARED]], [[CHAIN]]
 
 
 
 
 
 
 
 
''See:'' [[COMMON SHARED]]
 
  
  

Revision as of 23:30, 11 December 2009

COMMON shares common variable values with other Linked or CHAINed modules.


Syntax: COMMON [SHARED] [/blockname/] variablelist


  • COMMON must be called before any executable statements.
  • SHARED makes the variables shared within SUB and FUNCTION procedures within that module.
  • /blockname/ gives the ability to name a block of variables (ex. COMMON /thename/ a, b, c), this name can later be referenced in the module to only give access to those variables. As such many COMMON statements can be issued with different names to be shared in different modules.
  • Variablelist is the list of common variables made available separated by commas.
  • Remember to keep the variable type order the same in both modules as it is the order that matters and not the variables names.
  • COMMON SHARED is most commonly used (hence you almost always see them together in code), as then you don't need to share the variables seperately in the module for use in subs and functions of that module.
  • Common variables can only be passed by CHAIN using compiled modules if BRUN45.EXE is included with the program.
  • Linked files are compiled first and linked with LINK.EXE in QB. QB64 cannot link files presently!



See: COMMON SHARED, CHAIN


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage