Can I install both 32 and 64 FreeBASIC compilers?
-
- Posts: 3906
- Joined: Jan 01, 2009 7:03
- Location: Australia
Can I install both 32 and 64 FreeBASIC compilers?
I write my programs in FBIDE. I download the FBIDE with the out of date FreeBASIC compiler into a folder called FreeBASIC. I then install the latest version of the FB compiler into the same same folder which is how I was told I could replace the out of date compiler with the latest version which would still run with FBIDE.
I did the same with the FreeBASIC 64 bit version on my latest Window11 computer. Problem was my old programs would not compile without modification. Is there any way I can have a FBIDE running the 32 bit version and another FBIDE running the 64 bit version so I can run the old code without modification using one version and new code with the 64 bit version?
I would have been happy to stick with using the 32 bit FB compiler but thought I might update to the 64 bit FB compiler only to find problems with compiling old code. My understanding is that 32 bit compiled code will run on a 64 bit machine?
I fear I may have really messed up my computer now trying to install both.
Update:
It looks like I have overlayed the 32 bit FB version as my old code now compiles but modified code for the 64 bit version of FB no longer compiles.
Is there any advantage in running the 64 bit version? Will my programs run faster?
I did the same with the FreeBASIC 64 bit version on my latest Window11 computer. Problem was my old programs would not compile without modification. Is there any way I can have a FBIDE running the 32 bit version and another FBIDE running the 64 bit version so I can run the old code without modification using one version and new code with the 64 bit version?
I would have been happy to stick with using the 32 bit FB compiler but thought I might update to the 64 bit FB compiler only to find problems with compiling old code. My understanding is that 32 bit compiled code will run on a 64 bit machine?
I fear I may have really messed up my computer now trying to install both.
Update:
It looks like I have overlayed the 32 bit FB version as my old code now compiles but modified code for the 64 bit version of FB no longer compiles.
Is there any advantage in running the 64 bit version? Will my programs run faster?
Re: Can I install both 32 and 64 FreeBASIC compilers?
I'm sure there's no problem in installing both 32 and 64 bit compilers and IDEs, provided you configure each IDE to look for the right compiler.
As for advantages of running 64-bit over 32-bit, in most cases your program won't run any faster. In some rare cases it would actually be a tiny bit slower. And in other cases (where you use lots of memory), it might be quite a bit faster. Certainly on Windows, there's not specific advantage to running the 64-bit app over the 32-bit app, unless you need access to lots of memory. I think Windows by default installs the Wow64 subsystem, so the bits to support 32 and 64-bit apps are both there out of the box, so being 64-bit clean doesn't gain you any disk space really.
As for advantages of running 64-bit over 32-bit, in most cases your program won't run any faster. In some rare cases it would actually be a tiny bit slower. And in other cases (where you use lots of memory), it might be quite a bit faster. Certainly on Windows, there's not specific advantage to running the 64-bit app over the 32-bit app, unless you need access to lots of memory. I think Windows by default installs the Wow64 subsystem, so the bits to support 32 and 64-bit apps are both there out of the box, so being 64-bit clean doesn't gain you any disk space really.
Re: Can I install both 32 and 64 FreeBASIC compilers?
All FreeBASIC versions are extracted to their own folder. So you can make experiments with all FreeBASIC versions.
For example FreeBASIC-1.09.0-winlibs-gcc-9.3.0.7z:
It contains fbc32.exe and fbc64.exe.
You can extract FBIde0.4.6r4.zip to the FreeBASIC folder and rename the FBIde folder to FBIde0.4.6r4-32.
Then extract FBIde0.4.6r4.zip again into the FreeBASIC folder and name the FBIde folder for example FBIde0.4.6r4-64.
In each FBIde folder you can run fbide.exe and specify either fbc32.exe or fbc64.exe.
Two shortcuts FB-1.09.0-win32 and FB-1.09.0-win64 on the desktop are then sufficient.
You can test this for example with
Translated with www.DeepL.com/Translator (free version)
For example FreeBASIC-1.09.0-winlibs-gcc-9.3.0.7z:
It contains fbc32.exe and fbc64.exe.
You can extract FBIde0.4.6r4.zip to the FreeBASIC folder and rename the FBIde folder to FBIde0.4.6r4-32.
Then extract FBIde0.4.6r4.zip again into the FreeBASIC folder and name the FBIde folder for example FBIde0.4.6r4-64.
In each FBIde folder you can run fbide.exe and specify either fbc32.exe or fbc64.exe.
Two shortcuts FB-1.09.0-win32 and FB-1.09.0-win64 on the desktop are then sufficient.
You can test this for example with
Code: Select all
print __fb_version__
print __fb_signature__
print __fb_backend__
#IFDEF __FB_64BIT__
print "64Bit"
#ELSE
print "32Bit"
#ENDIF
sleep
-
- Posts: 3906
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: Can I install both 32 and 64 FreeBASIC compilers?
Thank you caseih for your responses.
Thank you hhr for your responses.
I understand what to do now.
Thank you hhr for your responses.
I understand what to do now.
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Can I install both 32 and 64 FreeBASIC compilers?
@BasicCoder2
hhr's solution works, but if you go to FreeBASIC IDEs/Editors you will find an IDE which will not be 17 years old in February since the last update and most do not require faffing about with two folders.
The list is long, and it would be a formidable task to evaluate all of them. Some are Windows only, some are Windows and Linux, and some have Visual Designers. Some have a steep learning curve, but some are so intuitive we don't need a help file
Start a new thread entitled “Which FreeBASIC IDE do you use and why?”
A response to that should interest most of us.
hhr's solution works, but if you go to FreeBASIC IDEs/Editors you will find an IDE which will not be 17 years old in February since the last update and most do not require faffing about with two folders.
The list is long, and it would be a formidable task to evaluate all of them. Some are Windows only, some are Windows and Linux, and some have Visual Designers. Some have a steep learning curve, but some are so intuitive we don't need a help file
Start a new thread entitled “Which FreeBASIC IDE do you use and why?”
A response to that should interest most of us.
Re: Can I install both 32 and 64 FreeBASIC compilers?
Yes please.deltarho[1859] wrote: ↑Jan 15, 2023 11:18 Start a new thread entitled “Which FreeBASIC IDE do you use and why?”
A response to that should interest most of us.
At some time I did manage to compile FBIDE from some sources using more up to date dependencies. I was never able to compile it to the executable size of the original. The version I built was always larger and I was never sure if it was from most up to date sources. But FBIDE continues to be a popular choice despite its age and I wonder if I should try to build and release something on my own; FBIDE it is not really within the scope of fb developers to support. imho, FBIDE remains a popular choice even though better alternatives are now available.
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Can I install both 32 and 64 FreeBASIC compilers?
Jeff, you have better things to do than flog a dead horse.coderJeff wrote:FBIDE it is not really within the scope of fb developers to support.
If an alternative is better then we should use it. We should support the better alternative authors and not some antiquated piece of code which no longer passes muster in 2023. FreeBASIC has better alternatives than we can shake a stick at. PowerBASIC effectively has two: PB, 12 years old, and JK - IDE in ongoing development.imho, FBIDE remains a popular choice even though better alternatives are now available.
Support your local butchers, local farms and local IDE developers.
-
- Posts: 3906
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: Can I install both 32 and 64 FreeBASIC compilers?
@deltarho[1859]
@coderJeff
I don't really spend much time for coding anymore but have a project I work on occasionally. So I don't have time to have to learn how to use another editor when FBIDE works fine. I don't do GUI stuff only simple things. I have used Geany as that is the one I used when programming with FreeBASIC on a Raspberry Pi. The Raspberry Pi is now not available due to some kind of shortage. I bought a 7 inch 1024x600 touch screen with the connections to attach a RPi to the back. Included a RPi camera and a wireless keyboard and mouse with the intention of making a RPi laptop.
You can do cool hardware interfacing with the RPi. The example code below blinks an LED. D.J.Peters showed me how to use FreeBASIC to control the i/o pins of the RPi.
viewtopic.php?p=263075
@coderJeff
I don't really spend much time for coding anymore but have a project I work on occasionally. So I don't have time to have to learn how to use another editor when FBIDE works fine. I don't do GUI stuff only simple things. I have used Geany as that is the one I used when programming with FreeBASIC on a Raspberry Pi. The Raspberry Pi is now not available due to some kind of shortage. I bought a 7 inch 1024x600 touch screen with the connections to attach a RPi to the back. Included a RPi camera and a wireless keyboard and mouse with the intention of making a RPi laptop.
You can do cool hardware interfacing with the RPi. The example code below blinks an LED. D.J.Peters showed me how to use FreeBASIC to control the i/o pins of the RPi.
viewtopic.php?p=263075
Last edited by BasicCoder2 on Jan 15, 2023 18:16, edited 1 time in total.
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Can I install both 32 and 64 FreeBASIC compilers?
If it did, then you would not have opened this thread.BasicCoder2 wrote:when FIDE works fine
Anyway, if you followed hhr's tip, you can now compile either 32-bit or 64-bit.
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Can I install both 32 and 64 FreeBASIC compilers?
Dear oh dear we don't need two folders in the context of this thread.Yours truly wrote:most do not require faffing about with two folders.
fbc64.exe and fbc32.exe are 64-bit and 32-bit binaries respectively. Their emitted files are identical.
So, we can use fbc64.exe in FBIde's 'Compiler path' without the need for a second folder.
The header of our bas file should have a #cmdline preprocessor directive.
Code: Select all
#cmdline "-arch 686"
Print "Back end is: " & __FB_BACKEND_
Sleep
Replace the first line with:
Code: Select all
#cmdline "-gen gas64"
Now try the first line as:
Code: Select all
#cmdline "-arch 686 -gen gcc"
Code: Select all
#ifdef __FB_64BIT__
Print "64-bit"
#else
Print "32-bit"
#endif
Now try the first line as:
Code: Select all
#cmdline "-gen gcc"
I now get "Back end is: gcc followed by "64-bit"
Summary:
#cmdline "-arch 686" => gas
#cmdline "-gen gas64" => gas64
#cmdline "-arch 686 -gen gcc" => gcc 32-bit
#cmdline "-gen gcc" => gcc 64-bit
The secret is to point to fbc64.exe and use the appropriate #cmdline.
No second folder is needed.
We can, of course, add an optimization level for the gcc statements.
We also need fbc >= 1.09.0
Re: Can I install both 32 and 64 FreeBASIC compilers?
deltarho,
very good suggestion. I would not have thought of that. Thank you.
very good suggestion. I would not have thought of that. Thank you.
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Can I install both 32 and 64 FreeBASIC compilers?
I have been using the same technique with WinFBE for some time.
My default build is Win64 GUI (Release). With '-arch 686' in the command line, the target becomes 'win32, 686, 32bit'. Without it the target becomes 'win64, x86-64, 64bit'. I only change the build for dlls and Static libraries, which is rare. I have made a few of my PRNG implementations into 32-bit dlls for PowerBASIC as it does not have 64-bit unsigned integers.
My default build is Win64 GUI (Release). With '-arch 686' in the command line, the target becomes 'win32, 686, 32bit'. Without it the target becomes 'win64, x86-64, 64bit'. I only change the build for dlls and Static libraries, which is rare. I have made a few of my PRNG implementations into 32-bit dlls for PowerBASIC as it does not have 64-bit unsigned integers.
-
- Posts: 3906
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: Can I install both 32 and 64 FreeBASIC compilers?
@deltarho[1859]
Thanks for all the suggestions.
Although others will no doubt make use of those suggestions I personally will just be using fbc32.exe so I don't have to worry about modifying old code or finding 64 bit versions of a .dll
Actually I think I need to make some minor modifications such as using ulong instead of integer.
Thanks for all the suggestions.
Although others will no doubt make use of those suggestions I personally will just be using fbc32.exe so I don't have to worry about modifying old code or finding 64 bit versions of a .dll
Actually I think I need to make some minor modifications such as using ulong instead of integer.
-
- Posts: 4308
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Can I install both 32 and 64 FreeBASIC compilers?
@BasicCoder2
If you use Integer and fbc32.exe you will be getting a Long. So, the question is do you need to use Ulong rather than Long and the answer to that is probably not.
If you use Integer and fbc32.exe you will be getting a Long. So, the question is do you need to use Ulong rather than Long and the answer to that is probably not.