Compiler Directives
Posted: Thu Oct 01, 2020 2:48 am
When dealing with cross platform apps, It would be helpfull to have a complile driective like #Compile_Console
http://www.purebasic.com
https://www.purebasic.fr/english/
Reserved Constants
The PureBasic compiler has several reserved constants which can be useful to the programmer:
Code: Select all
#PB_Compiler_ExecutableFormat : Determines executable format. It can be one of the following: #PB_Compiler_Executable : Regular executable #PB_Compiler_Console : Console executable (have an effect only on Windows, other act like a regular executable) #PB_Compiler_DLL : Shared DLL (dynlib on MacOS X and shared object on Linux)
The following code doesn't display any syntax error on my Lubuntu 18.04 with LXDE regardless if it is compiled with Executable Format "Linux" or "Console":Gary.Maine wrote:Nope, #PB_Compiler_Console = Syntax error Under Linux.
Code: Select all
CompilerSelect #PB_Compiler_ExecutableFormat
CompilerCase #PB_Compiler_Executable
MessageRequester("Info", "Executable format: Executable")
CompilerCase #PB_Compiler_Console
CompilerSelect #PB_Compiler_ExecutableFormat
CompilerCase #PB_Compiler_Executable
MessageRequester("Info", "Executable format: Executable")
CompilerCase #PB_Compiler_Console
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
OpenConsole("Executable format detection")
CompilerEndIf
PrintN("ExecutableFormat: Console")
PrintN("Press <Enter> to continue!")
Input()
CompilerCase #PB_Compiler_DLL
MessageRequester("Info", "Executable format: Library (.dll, .so or .dylib)")
CompilerEndSelect
CompilerCase #PB_Compiler_DLL
MessageRequester("Info", "Executable format: Library (.dll, .so or .dylib)")
CompilerEndSelect
[color=#0040FF][u]Help for Compiler Directives[/u][/color] wrote:#PB_Compiler_Console: Console executable (have an effect only on Windows, other act like a regular executable)