Understanding PureBasic compilation

Everything else that doesn't fall into one of the other PB categories.
Oso
Enthusiast
Enthusiast
Posts: 595
Joined: Wed Jul 20, 2022 10:09 am

Re: Understanding PureBasic compilation

Post by Oso »

Marc56us wrote: Thu Jul 21, 2022 8:15 am But in both cases, you have to put /OUTPUT followed by a name
Yes that's fixed it, Marc56us, thanks for finding the cause of this, I appreciate you trying that.

So the documentation is at fault really, as it gives two examples without /OUTPUT. It's also interesting that running the compilers with the /COMMENTED option also makes this successful AND launches the application after it has compiled, even though that wouldn't seem to be the purpose of the option. Anyway, at least it works when we know about this behaviour, it's still an amazingly good tool.
https://www.purebasic.com/documentation ... piler.html
Examples:
CLI> pbcompiler sourcecode.pb
The compiler will compile the source code and execute it.

CLI> pbcompiler sourcecode.pb --debugger
The compiler will compile the source code and execute it with debugger.
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: Understanding PureBasic compilation

Post by Marc56us »

On the PC who have only PB 6 /output (ou /exe or -o) is needed.

Code: Select all

C:\Test>"\Program Files\PureBasic\Compilers\pbcompilerc.exe" console2.pb
PureBasic 6.00 LTS - C Backend (Windows - x64) Free
Loading 'C' subsystem
Compiling console2.pb
Loading external libraries...
Starting compilation...
10 lines processed.
Creating and launching executable.
Error: Linker
error: Unresolved external symbol '_SetCurrentDirectoryA' - referenced from 'PureBasic.obj'.
POLINK: fatal error: 1 unresolved external(s).

C:\Test>"\Program Files\PureBasic\Compilers\pbcompilerc.exe" console2.pb -o console2.exe
PureBasic 6.00 LTS - C Backend (Windows - x64) Free
Loading 'C' subsystem
Compiling console2.pb
Loading external libraries...
Starting compilation...
10 lines processed.
Creating executable "console2.exe".

- Feel the ..PuRe.. Power -

C:\Test>
But on my PC who have PB 5.46, 5.73, 6 no need -o
mk-soft is right, compiler use differents existing setups.
weired
:wink:
User avatar
Otrebor
Enthusiast
Enthusiast
Posts: 201
Joined: Mon Mar 17, 2014 1:42 pm
Location: São Paulo, Brasil
Contact:

Re: Understanding PureBasic compilation

Post by Otrebor »

Paul wrote: Wed Jul 20, 2022 3:26 pm
For me, the exe's created with the 'C' backend run slower than same exe created with the 'ASM' backend. Might only be milliseconds is some cases but still slower.
Yes the exe size may be a few KB's smaller but certainly not worth the wait. I have one app when compiled with 'C' backend is 192KB smaller than the 'ASM' version but it takes 18 seconds to compile compared to 2 seconds with the 'ASM' backend. I can only imagine how painful the wait on a slow computer.
i noticed the speed difference after beta 3. But i still had beta 2 in my computer.
When i set full speed in my emulator i get:
ASM: 130FPS
C beta 2: 230FPS

Beta 4...LTS final : C output 170FPS
pTb
User
User
Posts: 16
Joined: Sat Apr 16, 2011 3:17 pm

Re: Understanding PureBasic compilation

Post by pTb »

Thanks a lot for this thread.

It made me realize I haven't been using the C backend yet... :D

I had a vague feeling it wasn't using it but I both didn't know how to change it in the IDE and hadn't put the time in it to be sure and find out.

So, I guess it's was a smart choice to not make the C compiler a default in the IDE - so nincompoops like me wouldn't hammer the bug report threads. :lol:

Well, I'm about to upgrade some of my small apps soon and now I will finally see what difference PB6 makes.

Be safe coders!
Post Reply