Compiler Option: -entry

Override the public exported name of the implicit user main function

Syntax
	-entry < name >

Parameters
	name
		The custom name that overrides the public exported name of the 
		implicit user main function

Description
	The -entry compiler option changes the name of the publicly export 
	symbol of the implicit user main function (automatically generated by 
	fbc as start-up code).
	It affects the start-up code and implicit user main, which is also 
	affected by the module being the main module or not.

	By default, fbc defines a publicly exported 'main' symbol in the main 
	module as required by the run time start-up system code.
	There is no other way currently to override fbc's use of the 'main' 
	symbol other than to always compile and link separately.

	Proceedings:
		- The custom main function name must only be declared with the 
		following signature (same parameter types, same return type, same 
		calling convention) to be compatible with the (basic) main function:
	'' internally the implicit main function is now named "custom_main"
	Declare Function custom_main cdecl Alias "custom_main" ( ByVal argc As Long, ByVal argv As ZString Ptr Ptr ) As Long
	         

		- The (basic) main function must also be provided to satisfy the 
		linker and start-up code. This might be defined in another libray or 
		framework, in C, or ASM, or fb language as shown by the following 
		minimum code example:
	Function main cdecl Alias "main" ( ByVal argc As Long, ByVal argv As ZString Ptr Ptr ) As Long
	   '' .....
	   '' call the custom main
	   Return custom_main( argc, argv )
	End Function
	         

		- Then compile with the -entry custom_main option.

	Note:
		This feature is being developed and may change in future (see 
		https://www.freebasic.net/forum/viewtopic.php?f=9&t=29504Compiler Option: -entry in Documentation forum).
		There will maybe a better way to deal with this: a compiler option 
		that lets to outright specify an explicit "main".

Example
	Example of program (option_entry.bas) trying to show the minimal code 
	for fb language only:
	'' option_entry.bas:

	'' - demonstrate alternate named main function
	''   as an alternate entry point for the implicit user main
	'' - we also can compile and link in separate steps

	'' compile: $ fbc -c -m option_entry option_entry.bas -entry custom_main
	'' compile: $ fbc option_entry.o
	'' OR
	'' compile: $ fbc option_entry.bas -entry custom_main

	'' internally the implicit main function is now named "custom_main"
	Declare Function custom_main cdecl Alias "custom_main" ( ByVal argc As Long, ByVal argv As ZString Ptr Ptr ) As Long

	'' But we still need a main() function to satisfy the linker and start-up code
	'' - this might be defined in another libray or framework
	'' - it's not so let's define it here for the demonstration
	Function main cdecl Alias "main" ( ByVal argc As Long, ByVal argv As ZString Ptr Ptr ) As Long
	   '' just call our custom main for demonstration
	   Return custom_main( argc, argv )
	End Function

	'' ---------------------------------
	'' START OF USER'S IMPLICIT MAIN
	'' internally this is named "custom_main" and will automatically be
	'' called by our custom frame work

	Print "hello"
	Sleep

	'' END OF USER'S IMPLICIT MAIN
	'' ---------------------------------
	      

Version
	* Since fbc 1.09.0

See also
	* CompilerOptmCompiler Option: -m
	* ProPgExecutablesExecutables

