Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Entry point
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Usage== Entry points apply both to source code and to [[executable]] files. However, in day-to-day [[software development]], programmers specify the entry points only in source code, which makes them much better known. Entry points in executable files depend on the [[application binary interface]] (ABI) of the actual operating system, and are generated by the compiler or linker (if not fixed by the ABI). Other linked [[object file]]s may also have entry points, which are used later by the linker when generating entry points of an executable file. Entry points are capable of passing on command arguments, variables, or other information as a local variable used by the <code>Main()</code> method. This way, specific options may be set upon execution of the program, and then interpreted by the program. Many programs use this as an alternative way to configure different settings, or perform a set variety of actions using a single program. ===Contemporary=== In most of today's popular programming languages and operating systems, a [[computer program]] usually only has a single ''entry point''. In [[C (programming language)|C]], [[C++]], [[D (programming language)|D]], [[Zig (programming language)|Zig]], [[Rust (programming language)|Rust]] and [[Kotlin (programming language)|Kotlin]] programs this is a [[Function (computer science)|function]] named <code>main</code>; in [[Java (programming language)|Java]] it is a [[static method]] named <code>main</code> (although the class must be specified at the invocation time), and in [[C Sharp (programming language)|C#]] it is a static method named <code>Main</code>.<ref>{{cite web |url=https://www.ibm.com/support/knowledgecenter/SSLTBW_2.3.0/com.ibm.zos.v2r3.cbclx01/mainf.htm |title=The main() function |publisher=[[IBM]] |work=ibm.com |access-date=2014-05-08 |archive-date=2017-09-10 |archive-url=https://web.archive.org/web/20170910083002/https://www.ibm.com/support/knowledgecenter/SSLTBW_2.3.0/com.ibm.zos.v2r3.cbclx01/mainf.htm |url-status=live }}</ref><ref>{{cite web |url=http://msdn.microsoft.com/en-us/library/acy3edy3.aspx |title=Main() and Command-Line Arguments (C# Programming Guide) |publisher=Msdn.microsoft.com |access-date=2014-05-08 |archive-date=2014-06-09 |archive-url=https://web.archive.org/web/20140609000508/http://msdn.microsoft.com/en-us/library/acy3edy3.aspx |url-status=live }}</ref> In many major operating systems, the standard executable format has a single entry point. In the [[Executable and Linkable Format]] (ELF), used in [[Unix]] and [[Unix-like]] systems such as [[Linux]], the entry point is specified in the <code>e_entry</code> field of the ELF header. In the [[GNU Compiler Collection]] (gcc), the entry point used by the linker is the <code>_start</code> symbol. Similarly, in the [[Portable Executable]] format, used in [[Microsoft Windows]], the entry point is specified by the <code>AddressOfEntryPoint</code> field, which is inherited from [[COFF]]. In [[COM file]]s, the entry point is at the fixed [[offset (computer science)|offset]] of 0100h. One exception to the single-entry-point paradigm is [[Android (operating system)|Android]]. Android applications do not have a single entry point{{snd}} there is no special <code>main</code> function. Instead, they have ''essential components'' (activities and services) which the system can load and run as needed.<ref>{{cite web |url=http://www.linuxtopia.org/online_books/android/devguide/guide/topics/fundamentals.html |title=Application Fundamentals |work=Android Development |access-date=2014-02-19 |publisher=linuxtopia.org |archive-date=2013-12-31 |archive-url=https://web.archive.org/web/20131231125154/http://www.linuxtopia.org/online_books/android/devguide/guide/topics/fundamentals.html |url-status=live }}</ref> An occasionally used technique is the [[fat binary]], which consists of several executables for different targets packaged in a single file. Most commonly, this is implemented by a single overall entry point, which is compatible with all targets and branches to the target-specific entry point. Alternative techniques include storing separate executables in separate [[fork (file system)|forks]], each with its own entry point, which is then selected by the operating system. ===Historical=== Historically, and in some contemporary [[legacy system]]s, such as [[OpenVMS|VMS]] and [[OS/400]], computer programs have a multitude of ''entry points'', each corresponding to the different functionalities of the program. The usual way to denote entry points, as used system-wide in VMS and in [[PL/I]] and [[Macro (computer science)|MACRO]] programs, is to append them at the end of the name of the [[executable image]], delimited by a [[dollar sign]] ($), e.g. <code>directory.exe$make</code>. The [[Apple I]] computer also used this to some degree. For example, an alternative entry point in Apple I's [[BASIC]] would keep the BASIC program useful when the reset button was accidentally pushed.{{Clarify|date=July 2010}}<!-- in memory? difficult to know without a reference -->
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)