So, I'm still waiting on my laptop to get here and then I'll be ordering PB.
Question. Is it really true I can write a program in Windows and compile in Windows and it will also work on Linux or a Mac OS? Without jumping thru hoops ?! It just works? Call me skeptical.
I think I will only be writing for windows on windows, but it's amazing to me that it can be done if true?
Thanks in advance.
Tim.
Really ? One exe for all OS's supported by PB? Nothing else needed?
-
- User
- Posts: 14
- Joined: Wed Nov 23, 2022 12:51 am
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
It can not be done out of the box, but i regularly compile linux versions on my windows machine by using virtualbox. The same could be done for Mac OS.
You get a seperate compiler and IDE for each platform (32 and 64 bit), not a windows crosscompiler that creates linux or Mac binaries.
You get a seperate compiler and IDE for each platform (32 and 64 bit), not a windows crosscompiler that creates linux or Mac binaries.
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
Since Linux and MacOS won't have much fun with exe-files natively, you can't. You need to compile it on the target system itself, or use a virtual machine.
BUT: The clou is, that one source code compiles for all OSes (excluding API calls (which are different on each OS, obviously) and very few commands which are limited by said OSes). In that case you can use the Compiler-commands to put in sections for a specific OS and by that really need one source for all.
BUT: The clou is, that one source code compiles for all OSes (excluding API calls (which are different on each OS, obviously) and very few commands which are limited by said OSes). In that case you can use the Compiler-commands to put in sections for a specific OS and by that really need one source for all.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
How gravely wrong you are. Not only do you have to compile on each OS, but you also have to use conditions that will execute different pieces of code on different types of OS. In addition, for different types of Linux, you are better off compiling on the type on which the program will run. That is, the program may not work the same on older versions, or if you compiled on Fedora, but you need to run it on Mint or Arch.
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
That's why there are different FireFox versionsAZJIO wrote: ↑Thu Dec 01, 2022 2:50 am How gravely wrong you are. Not only do you have to compile on each OS, but you also have to use conditions that will execute different pieces of code on different types of OS. In addition, for different types of Linux, you are better off compiling on the type on which the program will run. That is, the program may not work the same on older versions, or if you compiled on Fedora, but you need to run it on Mint or Arch.
For Linux I still compile under Ubuntu 20.04. So these also work from 20.04 up to currently 22.04 (or higher and all debian 11 versionen).
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
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
The program's source code needs to be run on each OS (Windows, Mac, Linux) to create a program for that OS. So you're partly right: you write one source code, that generates three different OS programs when compiled on those OSes. But not one source and one output that runs the program instantly on all three. You can't create a program on Windows and then run it on Linux (except with Wine).HoosierDaddy wrote: ↑Thu Dec 01, 2022 12:54 amIs it really true I can write a program in Windows and compile in Windows and it will also work on Linux or a Mac OS?
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
The point is though that, if you do it right, you can have a single source tree that eventually produces output for all three OSes rather than having three separate source trees one for each variant which all require simultaneous maintenance (for application changes) and individual maintenance (for operating system specific changes). The larger the application the bigger and more time consuming this operation becomes.
Re: Really ? One exe for all OS's supported by PB? Nothing else needed?
The advantage of this method is the execution speed of the final product and ability to use platform dependant special functions like the windows API on windows systems. Purebasic compiles into native executables instead of using a cross platform execution stack like Java does.
So you get the simplicity of a basic language without the basic language limitations as you can seamlessly use platform DLL's/Libraries and you can even include hand optimized assembler code if you need it.
"Write once and run anywhere" would be C or Java
ps: it gets even better, the latest purebasic version 6 includes a C backend which uses the rock solid and very performant gcc compiler suite to build the final executable.
So you get the simplicity of a basic language without the basic language limitations as you can seamlessly use platform DLL's/Libraries and you can even include hand optimized assembler code if you need it.
"Write once and run anywhere" would be C or Java
ps: it gets even better, the latest purebasic version 6 includes a C backend which uses the rock solid and very performant gcc compiler suite to build the final executable.