32bit or 64bit for compatibility?
Re: 32bit or 64bit for compatibility?
I have it... Use environment variable to refer to \AppData\ location. Like...
"D:\Program Files\PureBasic 5.42\PureBasic.exe" /P %APPDATA%\PB5.42_x64\PureBasic.prefs /T %APPDATA%\PB5.42_x64\Templates.prefs /A %APPDATA%\PB5.42_x64\Tools.prefs /H %APPDATA%\PB5.42_x64\History.db /NOEXT
"D:\Program Files\PureBasic 5.42\PureBasic.exe" /P %APPDATA%\PB5.42_x64\PureBasic.prefs /T %APPDATA%\PB5.42_x64\Templates.prefs /A %APPDATA%\PB5.42_x64\Tools.prefs /H %APPDATA%\PB5.42_x64\History.db /NOEXT
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
- NoahPhense
- Addict

- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: 32bit or 64bit for compatibility?
Kewl, I'll check that out. Possibly after I'll throw a few more things out there.. like
Let's say I have a .pb and a .pbi file on my desktop. When I 'mouseover' either of them, they both say "PureBasic Include". As listed below.
Let's say I have a .pb and a .pbi file on my desktop. When I 'mouseover' either of them, they both say "PureBasic Include". As listed below.
Code: Select all
[HKEY_CLASSES_ROOT\PureBasic.exe]
@="PureBasic Include"
[HKEY_CLASSES_ROOT\.pbi\ShellNew]
"NullFile"=""
[HKEY_CLASSES_ROOT\pbi_auto_file]
@="PureBasic Source"
[HKEY_CLASSES_ROOT\pbi_auto_file\shell]
[HKEY_CLASSES_ROOT\pbi_auto_file\shell\open]
[HKEY_CLASSES_ROOT\pbi_auto_file\shell\open\command]
@="\"C:\\pb\\542lts\\64\\PureBasic.exe\" \"%1\" /P \"C:\\Users\\noah\\AppData\\Roaming\\pb\\542lts\\64\\PureBasic.prefs\"/T \"C:\\Users\\noah\\AppData\\Roaming\\pb\\542lts\\64\\Templates.prefs\" /A \"C:\\Users\\noah\\AppData\\Roaming\\pb\\542lts\\64\\Tools.prefs\" /NOEXT"
Last edited by NoahPhense on Mon Jul 18, 2016 8:58 pm, edited 1 time in total.
Re: 32bit or 64bit for compatibility?
I don't mind sharing the History.db between 64 and 32bit versions for each specific PB release.
You can have History.db stored in x86 path and have the 64bit shortcut call History.db from x86 location or vice versa. :p
You can have History.db stored in x86 path and have the 64bit shortcut call History.db from x86 location or vice versa. :p
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: 32bit or 64bit for compatibility?
Merge the following and restart Windows. You should see what you expecting to see? :p
Also updated my earlier post containing the reg code.
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\PureBasic.exe]
@=""Also updated my earlier post containing the reg code.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
- NoahPhense
- Addict

- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: 32bit or 64bit for compatibility?
It worked. But I will be starting over shortly..Thunder93 wrote:Merge the following and restart Windows. You should see what you expecting to see? :p
Code: Select all
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\PureBasic.exe] @=""
Also updated my earlier post containing the reg code.
Just removed everything and used ccleaner (the reg feature) about 6 times in a row. Everytime you run it, it catches new pieces of pb in the reg, removes it, then when you run it again, it finds the pieces that were connected to the previous pb references.. you get what I'm saying.
Been using that app for more than 10 years. Anyhow.. I have all the info in files at this time.. the reg patches, shortcuts, etc..
Going to make a decision later, about which method I'm going to lock down.
BBL, need to food..
Re: 32bit or 64bit for compatibility?
Remember when I've said that I use a customized version of lexvictory IDE Tool to compile 32bit code from 64bit IDE Toolbar and vice versa. Source code be at the bottom.
Edit PBx64_LOCATION and PBx86_LOCATION variables with your information.
PBx64_LOCATION = \64\
PBx86_LOCATION = \86\
... based on your PB paths being C:\pb\542lts\32\ and C:\pb\542lts\64\
Create just the x86 executable, name it whatever you want. However I'll refer to it as CompilerCounterPart.exe.
Create new x86 IDE Tool.
In PB x86 Preferences, under General \ Toolbar \, and add the above tool.


Create new x64 IDE Tool.
In PB x64 Preferences, under General \ Toolbar \, and add the above tool.
Edit PBx64_LOCATION and PBx86_LOCATION variables with your information.
PBx64_LOCATION = \64\
PBx86_LOCATION = \86\
... based on your PB paths being C:\pb\542lts\32\ and C:\pb\542lts\64\
Create just the x86 executable, name it whatever you want. However I'll refer to it as CompilerCounterPart.exe.
Create new x86 IDE Tool.
- - commandline: field;
- "[Where_Ever_You_CreatedOrMovied_It_To]\CompilerCounterPart.exe" "/x64"
- "/FILE:%FILE" "/TEMPFILE:%TEMPFILE"
- x64PBCompiler
- Menu or Shortcut
In PB x86 Preferences, under General \ Toolbar \, and add the above tool.


Create new x64 IDE Tool.
- - commandline: field;
- "[Where_Ever_You_CreatedOrMovied_It_To]\CompilerCounterPart.exe" "/x86"
- "/FILE:%FILE" "/TEMPFILE:%TEMPFILE"
- x86PBCompiler
- Menu or Shortcut
In PB x64 Preferences, under General \ Toolbar \, and add the above tool.
Code: Select all
;Create an IDE tool with the arguments set to the following:
; "/FILE:%FILE" "/TEMPFILE:%TEMPFILE"
;You can also create another tool and add /EXE to the command arguments to create an exe/dll (you have to add .dll to the SaveFileRequester file field manually)
Global.s Purebasic_Path, PBx64_LOCATION, PBx86_LOCATION
PBx64_LOCATION = "\Program Files\"
PBx86_LOCATION = "\Program Files (x86)\"
#PROCESS_NAME_NATIVE = 1
Prototype.i QueryFullProcessImageName(hProcess, dwFlags, lpExeName, lpdwSize)
;Returns non-zero if success.
Procedure.i GetParentProcess(hwnd.l)
Protected result, hwndp.l, pid.l, snap.i, pinfo.PROCESSENTRY32
Protected buffer$, bufferSize, hProcess, libID, QueryFullProcessImageName.QueryFullProcessImageName
GetWindowThreadProcessId_(hwnd, @pid)
snap = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,0)
If snap
pinfo\dwSize=SizeOf(PROCESSENTRY32);
result = Process32First_(snap, @pinfo)
While result
If pid = pinfo\th32ProcessID
hProcess = OpenProcess_(#PROCESS_QUERY_INFORMATION, 0, pinfo\th32ParentProcessID)
If hProcess
libID = OpenLibrary(#PB_Any, "kernel32.dll")
If libID
bufferSize = 1024
buffer$ = Space(bufferSize)
QueryFullProcessImageName = GetFunction(libID, "QueryFullProcessImageNameA")
If QueryFullProcessImageName
result = QueryFullProcessImageName(hProcess, 0, @buffer$, @bufferSize)
Purebasic_Path = GetPathPart(buffer$)
EndIf
CloseLibrary(libID)
EndIf
CloseHandle_(hProcess)
EndIf
Break
EndIf
result = Process32Next_(snap, @pinfo)
Wend
CloseHandle_(snap)
EndIf
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,0,0,"proc",#PB_Window_Invisible)
GetParentProcess(WindowID(0))
#windowwidth = 550
#windowheight = 250
#dontcloseonOKcompile = 1
#droopyslibisinstalled = 0
Procedure Error(error.s)
MessageRequester("Error", error, #MB_ICONERROR)
EndProcedure
CompilerIf #droopyslibisinstalled = 0
Procedure WaitUntilWindowIsClosed()
Repeat
Until WaitWindowEvent()= #PB_Event_CloseWindow
ProcedureReturn 1
EndProcedure
Procedure.s GetTempDirectory() ; Return the temp directory
Protected WinTemp.s
WinTemp = Space(255)
GetTempPath_(255, WinTemp)
If Right(WinTemp, 1) <> "\" : WinTemp = WinTemp + "\" : EndIf
ProcedureReturn WinTemp
EndProcedure
CompilerEndIf
Debugger = Val(GetEnvironmentVariable("PB_TOOL_Debugger"))
inlineasm = Val(GetEnvironmentVariable("PB_TOOL_InlineASM"))
unicode = Val(GetEnvironmentVariable("PB_TOOL_Unicode"))
threadsafe = Val(GetEnvironmentVariable("PB_TOOL_Thread"))
xpskin = Val(GetEnvironmentVariable("PB_TOOL_XPSkin"))
onerror = Val(GetEnvironmentVariable("PB_TOOL_OnError"))
subsys.s = Trim(GetEnvironmentVariable("PB_TOOL_SubSystem"))
theexe.s = GetEnvironmentVariable("PB_TOOL_Executable")
;EnableExplicit
Define compileroptions.s = "",x.i, progparam.s,properfile.s,tempfile.s
If debugger : compileroptions+"/DEBUGGER " : EndIf
If inlineasm : compileroptions+"/INLINEASM " : EndIf
If unicode : compileroptions+"/UNICODE " : EndIf
If threadsafe : compileroptions+"/THREAD " : EndIf
If xpskin : compileroptions+"/XP " : EndIf
If onerror : compileroptions+"/LINENUMBERING " : EndIf
If subsys <> "" : compileroptions+"/SUBSYSTEM "+Chr(34)+subsys+Chr(34)+" " : EndIf
For x = 0 To CountProgramParameters()-1
progparam = ProgramParameter(x)
If FindString(UCase(progparam), "/FILE:", 0)
properfile = RemoveString(progparam,"/FILE:",#PB_String_NoCase)
ElseIf FindString(progparam, "/x64", 0)
Purebasic_Path = ReplaceString(Purebasic_Path, PBx86_LOCATION, PBx64_LOCATION)
ElseIf FindString(progparam, "/x86", 0)
Purebasic_Path = ReplaceString(Purebasic_Path, PBx64_LOCATION, PBx86_LOCATION)
ElseIf FindString(UCase(progparam), "/TEMPFILE:", 0)
tempfile = RemoveString(progparam,"/TEMPFILE:",#PB_String_NoCase)
ElseIf FindString(UCase(progparam), "/EXE", 0)
makeexe.s = SaveFileRequester("Create cross compiled exe", theexe, "*.exe,*.dll|*.exe;*.dll", 0)
If makeexe
If (LCase(Right(makeexe, 4)) <> ".exe") And (LCase(Right(makeexe, 4)) <> ".dll")
makeexe+".exe"
EndIf
compileroptions+"/EXE "+Chr(34)+makeexe+Chr(34)+" "
If LCase(Right(makeexe, 4)) = ".dll"
compileroptions+"/DLL "
EndIf
disablethedebugger = 1
Else
End
EndIf
Else
compileroptions+progparam+" "
EndIf
Next x
OpenWindow(0,0,0,#windowwidth,#windowheight,"PB compiler output", #PB_Window_SystemMenu)
ListViewGadget(0,0,0,#windowwidth,#windowheight)
AddGadgetItem(0,-1, "Compiler Options:")
AddGadgetItem(0,-1, compileroptions)
If properfile <> ""
compileroptions+Chr(34)+properfile+Chr(34)
ElseIf tempfile <> ""
compileroptions+Chr(34)+tempfile+Chr(34)
SetCurrentDirectory(GetTempDirectory())
Else
Error("You need to specify a file (with /FILE:) or a temp file (with /TEMPFILE:)")
End
EndIf
If disablethedebugger : compileroptions=RemoveString(compileroptions, "/DEBUGGER ") : EndIf ;for compiling as exe
wasanerror = 0
prog = RunProgram(Purebasic_Path+"\compilers\PBCompiler.exe", compileroptions, GetCurrentDirectory(), #PB_Program_Open|#PB_Program_Read|#PB_Program_Error|#PB_Program_Hide)
If prog
While ProgramRunning(prog)
If AvailableProgramOutput(prog)
progoutput.s = ReadProgramString(prog)
If FindString(LCase(progoutput), "error",0)
wasanerror = 1
Error(progoutput)
SetForegroundWindow_(WindowID(0))
EndIf
AddGadgetItem(0,-1, progoutput)
Else
WaitWindowEvent(0)
EndIf
Wend
CloseProgram(prog)
AddGadgetItem(0,-1, "Compiler Closed")
Else
Error("Could Not execute PB compiler")
EndIf
CompilerIf #dontcloseonOKcompile = 1
WaitUntilWindowIsClosed()
CompilerElse
If wasanerror
WaitUntilWindowIsClosed()
EndIf
CompilerEndIf
Last edited by Thunder93 on Tue Jul 19, 2016 6:45 pm, edited 1 time in total.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
- NoahPhense
- Addict

- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: 32bit or 64bit for compatibility?
Ok, here is what I have decided to go with for my LTS installs.
Quite simple really. Keeps everything where I need it and does not complicate the registry.
This needs to be prefaced with, I stripped out the registry from all old PB related data/info.
First, I installed both 32 and 64 bit versions. Making sure not to launch either of them before I got everything else setup.
The shortcuts are setup as such:
That's all for the shortcuts, it keeps all files in the same place:
After the shortcuts I push one registry setting that allows me to open [.pb .pbi and .pbp] with a double click:
I must note, that clicking files this way is NOT part of my normal work-flow. Although, I do like to have the ability when browsing old code. 99% of my work-flow is project based [.pbp], even if I only have 1 file in my project, I usually have a notes file with the project and I like to have direct access to it inside my IDE.
After the shortcuts and the registry piece. I always put back 3 other items (these are all person items to me, just thought I'd share):
Cheers!
- np
Quite simple really. Keeps everything where I need it and does not complicate the registry.
This needs to be prefaced with, I stripped out the registry from all old PB related data/info.
First, I installed both 32 and 64 bit versions. Making sure not to launch either of them before I got everything else setup.
The shortcuts are setup as such:
Code: Select all
C:\pb\542LTS\32\PureBasic.exe /portable
C:\pb\542LTS\64\PureBasic.exe /portable- history.db
- purebasic.prefs
- templates.prefs
- tools.pref
- updatecheck.xml
After the shortcuts I push one registry setting that allows me to open [.pb .pbi and .pbp] with a double click:
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\PureBasic.exe\shell\open\command]
@="\"C:\\pb\\542LTS\\64\\PureBasic.exe\" \"%1\" /PORTABLE"After the shortcuts and the registry piece. I always put back 3 other items (these are all person items to me, just thought I'd share):
- "Help" folder, containing WIN32.HLP
Which, if anyone didn't know, automatically hooks to the F1 key. (example below)After you type that first bracket, the item will auto-capitalize. Then if you click somewhere on the word MessageBox_ and hit F1 it opens the WIN32.HLP file and brings you to the MessageBox_() API.Code: Select all
MessageBox_( - I place a "pb_src" shortcut in the Examples folder that links to c:\pb_srv, which is where all of my code lives, both 32 and 64. It contains 5928 Files, 769 Folders.

- Then I import the color settings from: PBObsidian-Theme.prefs (my favorite right now)
sidebar: wish there was a place to find more 'dark' pb color schemes -- let me know if you come across some
Cheers!
- np
- NoahPhense
- Addict

- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: 32bit or 64bit for compatibility?
Ok, I have the source code open and I'm reading your instructions. I'll jump back in here if I hit any snags.
- NoahPhense
- Addict

- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: 32bit or 64bit for compatibility?
..first question..
PBx64_LOCATION = "\Program Files\"
PBx86_LOCATION = "\Program Files (x86)\"
Am I NOT to use the drive letter? C:
If not, then it would be
PBx64_LOCATION = "\pb\542LTS\64\"
PBx86_LOCATION = "\pb\542LTS\32\"
?
*EDIT* .. ok I have it setup .. so, I haven't really looked through the code yet to see what's up, so I'm going to do that first.. I guess this is just a shortcut to create different binary types from either IDE?
Tell me, what's wrong with the built in compiler selection from within the IDE?
ie, if I'm using the 64 bit IDE and I am working on a 32bit app, I only have to select it once from inside the compiler options.

Ok, I'm off to read that source code now .. shoot me your thoughts on the above.
- np
PBx64_LOCATION = "\Program Files\"
PBx86_LOCATION = "\Program Files (x86)\"
Am I NOT to use the drive letter? C:
If not, then it would be
PBx64_LOCATION = "\pb\542LTS\64\"
PBx86_LOCATION = "\pb\542LTS\32\"
?
*EDIT* .. ok I have it setup .. so, I haven't really looked through the code yet to see what's up, so I'm going to do that first.. I guess this is just a shortcut to create different binary types from either IDE?
Tell me, what's wrong with the built in compiler selection from within the IDE?
ie, if I'm using the 64 bit IDE and I am working on a 32bit app, I only have to select it once from inside the compiler options.

Ok, I'm off to read that source code now .. shoot me your thoughts on the above.
- np
Re: 32bit or 64bit for compatibility?
In the code it looks at the distinction (we tell via PBx??_LOCATION variables) that's for 32bit and 64bit paths and reverses it. The idea behind this is, one utility will work for across all versions of PB to run its counterpart versions. For instance my case;
PB 5.42 LTS x64
D:\Program Files\PureBasic 5.42\
PB 5.42 LTS x86
"D:\Program Files (x86)\PureBasic 5.42\
It'll also work for;
PB 5.41 LTS x64
D:\Program Files\PureBasic 5.41\
PB 5.41 LTS x86
"D:\Program Files (x86)\PureBasic 5.41\
It'll also work for
PB 5.40 LTS x64
D:\Program Files\PureBasic 5.40\
PB 5.40 LTS x86
"D:\Program Files (x86)\PureBasic 5.40\
... and so on.
This at the moment just meant to be alternative to the native toolbar item ' Compile / Run ', so one can see how the code runs and looks under the counterpart versions.
This meant to be quick and convenient feature to ' Compile / Run ' via PB IDE Toolbar, and save many clickings to test how it compiles and runs on its counterpart versions. Support additional Compilers via PB Toolbar
PB 5.42 LTS x64
D:\Program Files\PureBasic 5.42\
PB 5.42 LTS x86
"D:\Program Files (x86)\PureBasic 5.42\
It'll also work for;
PB 5.41 LTS x64
D:\Program Files\PureBasic 5.41\
PB 5.41 LTS x86
"D:\Program Files (x86)\PureBasic 5.41\
It'll also work for
PB 5.40 LTS x64
D:\Program Files\PureBasic 5.40\
PB 5.40 LTS x86
"D:\Program Files (x86)\PureBasic 5.40\
... and so on.
This at the moment just meant to be alternative to the native toolbar item ' Compile / Run ', so one can see how the code runs and looks under the counterpart versions.
This meant to be quick and convenient feature to ' Compile / Run ' via PB IDE Toolbar, and save many clickings to test how it compiles and runs on its counterpart versions. Support additional Compilers via PB Toolbar
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
- NoahPhense
- Addict

- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: 32bit or 64bit for compatibility?
I have tried setting it up, but it did not work for me and it's ok that it didn't. I really do not need it. No Offence (NoahPhense)Thunder93 wrote:This at the moment just meant to be alternative to the native toolbar item ' Compile / Run ', so one can see how the code runs and looks under the counterpart versions.
This meant to be quick and convenient feature to ' Compile / Run ' via PB IDE Toolbar, and save many clickings to test how it compiles and runs on its counterpart versions. Support additional Compilers via PB Toolbar
If/When I need to convert 64 --> 32 bit code, my ONLY concern is that I have a completely clean and separate environment. Which is what I have now, with /portable ..
Just for fun, I was able to create a tool, calling the 32 bit compiler, and placing it on the tool bar. Argument %FILE .. done. But again, that will not be my process or workflow.
When I'm going to convert 32 --> 64, I will open the 32 bit code in the 64 bit IDE.
When I'm going to convert 64 --> 32, I will open the 64 bit code in the 32 bit IDE.
- np
Re: 32bit or 64bit for compatibility?
I like the convenience it offers to test the code with the PB counterpart version, via PB IDE Toolbar. If I'm using PB 32bit IDE, I can see how it compiles and runs with PB 64bit compiler and vice versa.
It's separate environment, if you in 32bit PB IDE, it'll call the 64bit compiler. If you in 64bit PB IDE, it'll call the 32bit compiler.
I have been using this PB IDE tool of lexvictory, with my customization for ages and works good. I find it very useful, especially when testing people's code that has problems with the counterpart version of PB compiler.
I feel like we're still in 'stone age' times with how PB native way to be working with the counterpart architecture.

Anyways, when you use to Compile / Run, it'll create the executable with generic PB file name 'PureBasic.exe' in the current directory which be where-ever the source-code is located.
You can also create another PB IDE toolbar item and add /EXE to the commandline arguments to create an exe/dll, and have the SaveFileRequester() dialog appear where you can choose to save the created file.
Earlier I've update my previous post that's detailing steps, to include image.
It's separate environment, if you in 32bit PB IDE, it'll call the 64bit compiler. If you in 64bit PB IDE, it'll call the 32bit compiler.
I have been using this PB IDE tool of lexvictory, with my customization for ages and works good. I find it very useful, especially when testing people's code that has problems with the counterpart version of PB compiler.
I feel like we're still in 'stone age' times with how PB native way to be working with the counterpart architecture.

Anyways, when you use to Compile / Run, it'll create the executable with generic PB file name 'PureBasic.exe' in the current directory which be where-ever the source-code is located.
You can also create another PB IDE toolbar item and add /EXE to the commandline arguments to create an exe/dll, and have the SaveFileRequester() dialog appear where you can choose to save the created file.
Earlier I've update my previous post that's detailing steps, to include image.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley