OS$: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "The _OS$ function returns the operating system and QB64 compiler bit version used to compile a QB64 program. {{PageSyntax}} : {{Parameter|compilerVersion$}} = _OS$ {{PageDescription}} * Returns a STRING listing the OS as [WINDOWS], [LINUX] or [MACOSX] and the compiler bit format of [32BIT] or [64BIT]. Example: {{text|[WINDOWS][32BIT]}} * Allows a BAS program to be compiled with QB64 in Windows, Linux or MacOSX using different OS or language specifications...")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
The [[_OS$]] function returns the operating system and QB64 compiler bit version used to compile a QB64 program.
{{DISPLAYTITLE:_OS$}}
The [[_OS$]] function returns the operating system and QB64 compiler bit version '''used to compile''' a QB64 program.




Line 7: Line 8:


{{PageDescription}}
{{PageDescription}}
* Returns a [[STRING]] listing the OS as [WINDOWS], [LINUX] or [MACOSX] and the compiler bit format of [32BIT] or [64BIT]. Example: {{text|[WINDOWS][32BIT]}}
* Returns a [[STRING]] listing the OS as [WINDOWS], [LINUX] or [MACOSX] and the compiler bit format of [32BIT] or [64BIT]. Example: {{Text|[WINDOWS][32BIT]}}
* Allows a BAS program to be compiled with QB64 in Windows, Linux or MacOSX using different OS or language specifications.
* Allows a BAS program to be compiled with QB64 in Windows, Linux or macOS using different OS or language specifications.
* Use the return {{Parameter|compilerVersion$}} to specify the current OS code to use when a BAS program is compiled using another version of the QB64 compiler.
* Use the return {{Parameter|compilerVersion$}} to specify the current OS code to use when a BAS program is compiled using another version of the QB64 compiler.
* Windows can use either a 32 (default) or 64 bit compiler. Linux and Mac use 64 bit by default.
* Windows can use either a 32 (default) or 64 bit compiler. Linux and macOS use 64 bit by default.
<!-- * Explanation by Galleon: http://www.qb64.net/forum/index.php?topic=12193.msg105406#msg105406 -->
 
;*Important Note:Even if you're on a 64-bit Windows system, the [[_OS$]] function may return [32BIT].
:*That is, if your program was compiled with the 32-bit version of QB64, hence it's a 32-bit executable running on 64-bit Windows.
:*This is by design and not a bug, as your program gets the information it needs to run (e.g. to use 32-bit or 64-bit DLL using DECLARE DYNAMIC LIBRARY) and not what you as user would expect to see according to your system.
:*That's why the "'''used to compile'''" phrase was printed bold in the first line above.





Latest revision as of 22:40, 11 February 2023

The _OS$ function returns the operating system and QB64 compiler bit version used to compile a QB64 program.


Syntax

compilerVersion$ = _OS$


Description

  • Returns a STRING listing the OS as [WINDOWS], [LINUX] or [MACOSX] and the compiler bit format of [32BIT] or [64BIT]. Example: [WINDOWS][32BIT]
  • Allows a BAS program to be compiled with QB64 in Windows, Linux or macOS using different OS or language specifications.
  • Use the return compilerVersion$ to specify the current OS code to use when a BAS program is compiled using another version of the QB64 compiler.
  • Windows can use either a 32 (default) or 64 bit compiler. Linux and macOS use 64 bit by default.
Important Note
  • Even if you're on a 64-bit Windows system, the _OS$ function may return [32BIT].
  • That is, if your program was compiled with the 32-bit version of QB64, hence it's a 32-bit executable running on 64-bit Windows.
  • This is by design and not a bug, as your program gets the information it needs to run (e.g. to use 32-bit or 64-bit DLL using DECLARE DYNAMIC LIBRARY) and not what you as user would expect to see according to your system.
  • That's why the "used to compile" phrase was printed bold in the first line above.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link