Wiki improvements

Forum for discussion about the documentation project.
Post Reply
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Thanks.
Done:
KeyPgDdfbargc → fxm [added precision]
KeyPgDdfbargv → fxm [added precision]
D.J.Peters
Posts: 8481
Joined: May 28, 2005 3:28
Contact:

Re: Wiki improvements

Post by D.J.Peters »

@fxm may be you could write a short note at KeyPgDdfbargv about:
End main( __FB_ARGC__, __FB_ARGV__ )

Calling END will never call any active destructure or make a reference to the description of the END command under the list
See also:
  • __FB_ARGC__
  • Command
  • End <-- add this
Joshy
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Why not rightly simplify the code of the example:
(moreover, this use of END or SYSTEM to terminate a program is discouraged for FB)

Code: Select all

Sub displayCommandLineArguments( ByVal argc As Integer, ByVal argv As ZString Ptr Ptr )
    Dim i As Integer
    For i = 0 To argc - 1
        Print "arg "; i; " = '"; *argv[i]; "'"
    Next i
End Sub

displayCommandLineArguments( __FB_ARGC__, __FB_ARGV__ )

Sleep

[edit]
Done:
KeyPgDdfbargv → fxm [simplified example]
Last edited by fxm on Jul 06, 2022 5:37, edited 1 time in total.
Reason: Update.
speedfixer
Posts: 593
Joined: Nov 28, 2012 1:27
Location: California
Contact:

Re: Wiki improvements

Post by speedfixer »

zero terminated command line arguments passed in on the command line
Perhaps a good change might be:
zero terminated command line and arguments passed in on the command line

david
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

The corresponding sentence has already recently been amended as follows (proposed by @SARG):
Substituted with a pointer to a list of pointers to the zero terminated command line arguments passed in on the command line including the name of the executable.
see __FB_ARGV__.
SARG
Posts: 1489
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

In the ASC page there is a small problem with the texts related to unicode example.

'will produce the output:' is before the code and the ouput is at the bottom of the page (after platform differences, etc).
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Known formatting problem, only for the manual.chm (wiki is OK), but no solution found yet.
I can't do new tests now because the daily builds for the manual.chm are broken.

Same problem for INSTR, INSTRREV, LEFT, MID (Function), RIGHT, WCHR and WSTRING pages.
SARG
Posts: 1489
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

In executables pages https://www.freebasic.net/wiki/ProPgExecutables
a64 can be removed/replaced by asm as -gen gas64 generates, now, files with the normal extension for assembler.
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Can you be more specific for me to properly update this documentation page: gas64 change date or since which fbc version?

This information, in the documentation page, is taken from:
coderJeff wrote: Jan 30, 2021 14:56 Compile process for an executable

When fbc compiles basic source code, it translates the source in to another format that can be used by other tools that eventually create an executable. By default, fbc will use these other tools automatically.
To see all the steps that fbc uses, specify '-v' on the command line to see the steps.
For example, on win32:

Code: Select all

$ fbc a.bas -v
FreeBASIC Compiler - Version 1.08.0 (2021-01-24), built for win32 (32bit)
Copyright (C) 2004-2021 The FreeBASIC development team.
standalone
target:       win32, 486, 32bit
backend:      gas
compiling:    a.bas -o a.asm (main module)
assembling:   D:\fb.git\bin\win32\as.exe --32 --strip-local-absolute "a.asm" -o "a.o"
linking:      D:\fb.git\bin\win32\ld.exe -m i386pe -o "a.exe" -subsystem console
"D:\fb.git\lib\win32\fbextra.x" --stack 1048576,1048576 -s -L "D:\fb.git\lib\win32" 
-L "." "D:\fb.git\lib\win32\crt2.o" "D:\fb.git\lib\win32\crtbegin.o" "D:\fb.git\lib\win32\fbrt0.o"
"a.o" "-(" -lfb -lgcc -lmsvcrt -lkernel32 -luser32 -lmingw32 -lmingwex -lmoldname -lgcc_eh "-)"
"D:\fb.git\lib\win32\crtend.o"
Tools:
- [ fbc ] compiler translate *.bas in to *.a64 or *.asm or *.c files
- [ gcc ] compiler translate *.c files in to *.asm files
- [ as ] assembler translate *.asm/*.a64 files in to *.o object files
- [ ld ] linker join *.o files (and other files) in to executable files
- emscripten backend has other tools
- llvm backend has other tools


GNU assembler 32-bit backend (-gen gas)

*.bas => [ fbc ] => *.asm compile (first stage) to assembly (-r or -rr, -R or -RR)
*.asm => [ as ] => *.o assemble to object file (-c, -C)
*.o => [ ld ] => *[.exe] link to executable

GNU assembler 64-bit backend (-gen gas64)

*.bas => [ fbc ] => *.a64 compile (first stage) to assembly (-r or -rr, -R or -RR)
*.a64 => [ as ] => *.o assemble to object file (-c, -C)
*.o => [ ld ] => *[.exe] link to executable

GCC compiler backend (-gen gcc)

*.bas => [ fbc ] => *.c compile (first stage) to C (-r, -R)
*.c => [ gcc ] => *.asm compile (second stage) to assembly (-rr, -RR)
*.asm => [ as ] => *.o assemble to object file (-c, -C)
*.o => [ ld ] => *[.exe] link to executable


Options controlling compile / assemble / link stages:

There are a few options that can control what fbc does with the intermediate files and at what point the process may be stopped early.

-r, -rr, -c : stop the compile / assemble process sometime before the link stage
-R, -RR, -C : keep intermediate files at compile / assemble stages then continue to next stage

Compiler Option -r : compile up to first stage, keep file (*.asm/*.a64/*.c), and stop
Compiler Option -rr : compile up to second stage, keep file (*.asm), and stop
Compiler Option -c : compile up to assembly stage, keep file (*.o), and stop

Compiler Option -R : don't delete compile (first stage) intermediate file (*.asm/*.a64/*.c)
Compiler Option -RR : don't delete compile (second stage) intermediate file (*.asm)
Compiler Option -C : don't delete assemble stage intermediate file (*.o)

-r : option overrides -rr, -RR, -c, -C
-rr : overrides overrides -c, -C
-r and -rr : behave the same if there is only one compile stage
-R and -RR : behave the same if there is only one compile stage

-r, -rr, -c : override the default behaviour of creating an implicit "main" entry point, and no "main" function is created by default. To have a "main" entry point when using the -r, -rr, -c, options, then '-m module' option needs to be used to indicate which module should have an "main" function.

-dll and -lib options
In general, the above for -r, -R, -rr, -RR, -c, -C should hold true for -lib and -dll, however default behaviours for the implicit main are probably different? I haven't verified for myself yet....
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

fxm wrote: Jul 26, 2022 14:26 Can you be more specific for me to properly update this documentation page: gas64 change date or since which fbc version?
OK now.
I found this change on Jun 2021 (therefore since fbc version 1.09.0):
gas64 : .a64 replaced by .asm to be coherent with documentation
SARG
Posts: 1489
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

@fxm
Sorry not at home (bicycle ride) this afternoon I just read the post now.
You are right.
Thanks for the update.
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Update done:
ProPgExecutables → fxm [since fbc version 1.09.0, '.a64' (from gas64) replaced by '.asm' to be coherent]
SARG
Posts: 1489
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

@fxm
With the help of Jeff I can now create an uptodate manual when necessary.
Lastest version : https://users.freebasic-portal.de/sarg/fbdoc.chm
fxm
Moderator
Posts: 11204
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Very good news after Jeff's ability to build an update patch for windows standalone fbc 1.09.0 to fbc 1.10.0 winlibs/gcc-9.3 - 32bit and 64bit combined version (fbc32.exe & fbc64.exe).

You could also put an advert in the thread: Where can I get a Recent-Git-Build of FreeBASIC?
SARG
Posts: 1489
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

fxm wrote: Aug 01, 2022 18:02 You could also put an advert in the thread: Where can I get a Recent-Git-Build of FreeBASIC?
Done.
Post Reply