PureBasic Forum
https://www.purebasic.fr/english/

OS Function
https://www.purebasic.fr/english/viewtopic.php?f=13&t=8187
Page 1 of 1

Author:  Akuma no Houkon [ Tue Nov 04, 2003 7:28 pm ]
Post subject:  OS Function

Is there a function that can report if you are using the linux or the windows compiler? So somethings that you are forced to use API for or other things, can be optional like:

#If GetOS() = Linux
LoadLibrary(0, "MyLINUXFunction.so")
#Else
LoadLibrary(0, "MyWindowsFunction.DLL")
#EndIf

Failing that, does anyone know how to detect if you are in linux, or windows? I dont want to keep two separate source copies just to compile on two separate OS's

Author:  Berikco [ Tue Nov 04, 2003 7:40 pm ]
Post subject: 

It's all in the help file under Compiler Directives

Code:
Works exactly like a regular Select : EndSelect but will tell the compiler which code should be compiled. It's useful when building multi-OSes programs to customize some programs part by using OS specific functions.

Example :

CompilerSelect #OS
  CompilerCase #AmigaOS
    ; some Amiga specific code
  CompilerCase #Linux    ; some Linux specific code
CompilerEndSelect

 

Reserved Constants

The PureBasic compiler has several reserved constants which can be useful to the programmer:

  #PB_Compiler_Date: Contains the current date, at the compile time, in the PureBasic date format (see Date).
  #PB_Compiler_OS : This constant allows to determine on which OS the compiler is currently running. It can be one of the following value:
    - #PB_OS_Windows: The compiler is running on Windows
    - #PB_OS_Linux:   The compiler is running on Linux
    - #PB_OS_AmigaOS: The compiler is running on AmigaOS
     

Author:  Akuma no Houkon [ Tue Nov 04, 2003 8:23 pm ]
Post subject: 

Thanks

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/