Page 1 of 1

How to determine cross-platform OS architecture?

Posted: Sun Aug 06, 2023 11:32 am
by damn
I know how to do it on Windows OS, but not on Linux and MacOS.

Re: How to determine cross-platform OS architecture?

Posted: Sun Aug 06, 2023 12:52 pm
by mk-soft
Purebasic uses the respective OS libraries to create programs.
It must be compiled on the respective operating system.

If you use OS specific API, you can only customise it in the source code.

Code: Select all

CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Windows
    ;
  CompilerCase #PB_OS_Linux
    ;
  CompilerCase #PB_OS_MacOS
    ;
CompilerEndSelect

Re: How to determine cross-platform OS architecture?

Posted: Sun Aug 06, 2023 4:55 pm
by damn
I know how separate code for each platform with compiler conditions. But I need a methods for linux and mac. This is problem for me.

Re: How to determine cross-platform OS architecture?

Posted: Sun Aug 06, 2023 4:59 pm
by jacdelad
Your question is not clear. Can you ask it in another way?

Re: How to determine cross-platform OS architecture?

Posted: Sun Aug 06, 2023 8:56 pm
by Bitblazer
damn wrote: Sun Aug 06, 2023 11:32 am I know how to do it on Windows OS, but not on Linux and MacOS.
Linux system information includes a classic textmode shell version. The source is included too, so you can rip what you need :)

I hope i understood your question correctly, it is a bit vague.

Re: How to determine cross-platform OS architecture?

Posted: Sun Aug 06, 2023 10:02 pm
by damn
Sorry for my English =(.

For example:

Code: Select all

Procedure.a is64()
	Protected Info.SYSTEM_INFO
		
	GetNativeSystemInfo(Info)
		
	If info\wProcessorArchitecture
		ProcedureReturn #True
	EndIf
		
	ProcedureReturn #False
EndProcedure
This code work fine for Windows OS, but I need some code like this for other OS.