Dual Support PB604 and PB610 Identification
Dual Support PB604 and PB610 Identification
I have a program developed originally on the 32 bit versions currently working well and also same source compiles and runs well on 6.10 version. I have placed the 32 bit version in PBUNI604 folder and the 64 bit version in PBUNI610 folder. The program is a project and is setup so that no compiler info is saved or stored once compiled in the project. I want to continue developing these as 32 and 64 bit versions as clones of each other. What I want to do now is find a way to adjust an added string content to reflect whether the program when running is the 32 bit version or the 64 bit version and I would like to do it dynamically. In other words I dont want to manually assign "32" to the string and "64" to the same string based upon which version I am running because then the source codes for each project would not be the same. I want a way using the same source code to be able to identify and adjust programatically when run the string contents to either "32" or "64" to reflect which version 32 or 64 is running. Something similar to the CompileIf but just identifying 32 or 64 bit version. I was thinking along the lines of code which throws an error in the 64 bit version but not in the 32 bit version when the program starts up which then adjusts the string contents based on the On Error Syntax. Is there an easy way to do this? My main objective is that the source code in the project must remain the exact same for both 32 and 64 bit versions to make support and development fluid and easy. Thanks in advance for any thoughts.
Experience is what you get when you didn't get what you thought you wanted!
Acer TC895 32gb i5-2.9ghz Win10 1.5tb ssd Asus Gsyn 4k and Vizio 1080 hd monitors.
Acer TC895 32gb i5-2.9ghz Win10 1.5tb ssd Asus Gsyn 4k and Vizio 1080 hd monitors.
Re: Dual Support PB604 and PB610 Identification
Hi,
if I understand your request right, you can use the system constant #PB_Processor_x64:
if I understand your request right, you can use the system constant #PB_Processor_x64:
Code: Select all
CompilerSelect #PB_Compiler_Processor
CompilerCase #PB_Processor_x64
#MyConst$ = "x64"
CompilerCase #PB_Processor_x86
#MyConst$ = "x86"
CompilerCase #PB_Processor_Arm32
#MyConst$ = "ARM32"
CompilerCase #PB_Processor_Arm64
#MyConst$ = "ARM64"
CompilerDefault
#MyConst$ = "Uh, oh..."
CompilerEndSelect
Debug #MyConst$
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Dual Support PB604 and PB610 Identification
Code: Select all
CompilerSelect #PB_Compiler_Processor
CompilerCase #PB_Processor_x86
#RTProcessor = "x86"
CompilerCase #PB_Processor_x64
#RTProcessor = "x64"
CompilerCase #PB_Processor_Arm32
#RTProcessor = "arm32"
CompilerCase #PB_Processor_Arm64
#RTProcessor = "arm64"
CompilerEndSelect
Debug #RTProcessor
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Dual Support PB604 and PB610 Identification
Brute short version...

Code: Select all
a=(#PB_Compiler_Processor-1)/2
Debug Mid("ARMX",(~a&2)<<1,3) + Str(32<<Bool(a%3))
Re: Dual Support PB604 and PB610 Identification
Michael Vogel wrote: Tue Apr 02, 2024 4:44 pmBrute short version...![]()
Code: Select all
a=(#PB_Compiler_Processor-1)/2 Debug Mid("ARMX",(~a&2)<<1,3) + Str(32<<Bool(a%3))

Hygge
Re: Dual Support PB604 and PB610 Identification
Wow. I didn't think it was possible to code golf in PB like thatMichael Vogel wrote: Tue Apr 02, 2024 4:44 pm Brute short version...![]()
Code: Select all
a=(#PB_Compiler_Processor-1)/2 Debug Mid("ARMX",(~a&2)<<1,3) + Str(32<<Bool(a%3))

Re: Dual Support PB604 and PB610 Identification
Thanks All 

Experience is what you get when you didn't get what you thought you wanted!
Acer TC895 32gb i5-2.9ghz Win10 1.5tb ssd Asus Gsyn 4k and Vizio 1080 hd monitors.
Acer TC895 32gb i5-2.9ghz Win10 1.5tb ssd Asus Gsyn 4k and Vizio 1080 hd monitors.
Re: Dual Support PB604 and PB610 Identification
Code: Select all
;Is 32/64Bit
If SizeOf(Integer) = 8
Debug "64-bit system (x64)"
ElseIf SizeOf(Integer) = 4
Debug "32-bit system (x86)"
Else
Debug "Something wrong here."
EndIf
- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Re: Dual Support PB604 and PB610 Identification
#PB_Compiler_64Bit can be used for this:
Code: Select all
Debug #PB_Compiler_64Bit
Re: Dual Support PB604 and PB610 Identification
Michael Vogel wrote: Tue Apr 02, 2024 4:44 pm Brute short version...![]()
Code: Select all
a=(#PB_Compiler_Processor-1)/2 Debug Mid("ARMX",(~a&2)<<1,3) + Str(32<<Bool(a%3))
I’m in awe… but
So simple and, especially, so much clearer.Fred wrote: Wed Apr 03, 2024 3:05 pm #PB_Compiler_64Bit can be used for this:
Code: Select all
Debug #PB_Compiler_64Bit
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: Dual Support PB604 and PB610 Identification
True, unless you want to tell more than just 32 or 64-bit. Michael's method can also tell you ARM/ARM64Blue wrote: Thu Apr 04, 2024 3:12 pmMichael Vogel wrote: Tue Apr 02, 2024 4:44 pm Brute short version...![]()
Code: Select all
a=(#PB_Compiler_Processor-1)/2 Debug Mid("ARMX",(~a&2)<<1,3) + Str(32<<Bool(a%3))
I’m in awe… but
So simple and, especially, so much clearer.Fred wrote: Wed Apr 03, 2024 3:05 pm #PB_Compiler_64Bit can be used for this:
Code: Select all
Debug #PB_Compiler_64Bit
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Dual Support PB604 and PB610 Identification
Endless variations are possible...

Code: Select all
CompilerIf #PB_Compiler_Version<600
Debug Mid("ARMX",Bool(#PB_Compiler_Processor&6-6)<<2,3) + Str(32<<Bool(#PB_Compiler_Processor&$D=4))
CompilerElse
Debug Mid("ARMX",Bool(#PB_Compiler_Processor&6-6)<<2,3) + Str(32<<#PB_Compiler_64Bit)
CompilerEndIf
Re: Dual Support PB604 and PB610 Identification
oh yes.
Endless obfuscations too.
But, as i commented above, I’m still in awe of the intellectual contorsions.
It takes a code acrobat to come up with something like this, and I’ve always envied acrobats.
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: Dual Support PB604 and PB610 Identification
Does being skilled at inserting a foot in own ones mouth count? There are days I could put on a great act.Blue wrote: Thu Apr 04, 2024 5:55 pmoh yes.
Endless obfuscations too.
But, as i commented above, I’m still in awe of the intellectual contorsions.
It takes a code acrobat to come up with something like this, and I’ve always envied acrobats.
Code: Select all
"Foot in one's mouth" is an idiom that means to say something foolish, embarrassing, or tactless. For example, "Jane put her foot in her mouth when she called him by her first husband's name". This idea is sometimes expressed as having "foot-in-mouth disease". "Foot-in-mouth disease" is an informal, facetious term for the habit of making inappropriate, insensitive, or imprudent statements.
Re: Dual Support PB604 and PB610 Identification
Are you saying you're agile at putting your foot in your mouth ?Jeromyal wrote: Sun Apr 07, 2024 1:56 pm [...]
Does being skilled at inserting a foot in own ones mouth count? There are days I could put on a great act.
[…]

That would certainly count... however you do it.

We run a club for that. You could join.
PB Forums : Proof positive that 2 heads (or more...) are better than one 
