Object code: Difference between revisions

Content deleted Content added
m top: grammar
remove "citation needed" and add cite
 
(72 intermediate revisions by 55 users not shown)
Line 1:
{{short description|Sequence of statements or instructions in a computer language}}
{{Use dmy dates|date=July 2012}}
{{distinguish|Object-oriented programming}}
'''Object code''', or sometimes an '''object module''', is what a computer [[compiler]] produces.<ref>{{cite web|url=http://whatis.techtarget.com/definition/0,,sid9_gci211824,00.html|title=Compiler|publisher=TechTarget|quote=Traditionally, the output of the compilation has been called object code or sometimes an object module.|accessdate=1 September 2011}}</ref> In a general sense object code is a sequence of [[Statement (computer science)|statements]] or instructions in a computer language,<ref>{{cite book|last1=Aho|first1=Alfred V.|authorlink1=Alfred Aho|last2=Sethi|first2=Ravi|authorlink2=Ravi Sethi|last3=Ullman|first3=Jeffrey D.|authorlink3=Jeffrey Ullman|title=Compilers: principles, techniques, and tools|series=Computer Science|year=1986|publisher=Mark S. Dalton|isbn=0-201-10194-7|page=704|chapter=10 Code Optimization}}</ref> usually a [[machine code]] language (i.e., 1's and 0's) or an intermediate language such as [[Register Transfer Language|RTL]].
{{Use dmy dates|date=JulyApril 20122025}}
{{Program execution}}
In [[computing]], '''object code''' or '''object module''' is the product of an [[assembler (computing)|assembler]] or [[compiler]].<ref>{{cite web|url=http://whatis.techtarget.com/definition/0,,sid9_gci211824,00.html|title=Compiler|publisher=TechTarget|quote=Traditionally, the output of the compilation has been called object code or sometimes an object module.|access-date=1 September 2011|archive-date=29 April 2012|archive-url=https://web.archive.org/web/20120429115801/http://whatis.techtarget.com/definition/0,,sid9_gci211824,00.html|url-status=dead}}</ref>
 
In a general sense, object code is a sequence of [[statement (computer science)|statements]] or instructions in a computer language,<ref>{{cite book |last1=Aho |first1=Alfred V. |author-link1=Alfred Aho |title=Compilers: principles, techniques, and tools |last2=Sethi |first2=Ravi |author-link2=Ravidassia |last3=Ullman |first3=Jeffrey C. |author-link3=Jeffrey Ullman |publisher=Mark S. Dalton |year=1986 |isbn=0-201-10194-7 |series=Computer Science |page=[https://archive.org/details/compilersprincip0000ahoa/page/704 704] |chapter=10 Code Optimization |chapter-url=https://archive.org/details/compilersprincip0000ahoa/page/704}}</ref> usually a [[machine code]] language (i.e., [[binary file|binary]]) or an intermediate language such as [[register transfer language]] (RTL). The term indicates that the code is the [[goal]] or result of the compiling process, with some early sources referring to source code as a "subject program".<ref>{{cite journal |last1=Luebbert |first1=William F. |last2=Collom jr. |first2=Percy |title=Signal Corps Research and Development on Automatic Programming of Digital Computers |journal=Communications of the ACM |date=February 1959 |volume=2 |issue=2 |pages=22–27 |url=https://doi.org/10.1145/368280.368293 |access-date=July 20, 2025}}</ref>
Object files can in turn be [[Linker (computing)|linked]] to form executable file or library file. In order to be used, object code must either be placed in an executable file, a library file, or an [[object file]].
 
==Details==
Object code is a portion of machine code that hasn't yet been linked into a complete program. It's the machine code for one particular library or module that will make up the completed product. It may also contain placeholders or offsets not found in the machine code of a completed program that the linker will use to connect everything together.
[[Object filesfile]]s can in turn be [[Linkerlinker (computing)|linked]] to form an [[executable file]] or [[library (computing)|library file]]. In order to be used, object code must either be placed in an executable file, a library file, or an [[object file]].
Machine code is binary (1's and 0's) code that can be executed directly by the cpu. If you were to open a "machine code" file in a text editor you would see garbage, including unprintable characters.
 
Object code is a variant of machine code, with a difference that the jumps are sort of parameterized such that a linker can fill them in.
Object code is a portion of machine code that hasn'thas not yet been linked into a complete program. It's is the machine code for one particular library or module that will make up the completed product. It may also contain placeholders or offsets, not found in the machine code of a completed program, that the linker will use to connect everything together. Whereas machine code is binary code that can be executed directly by the CPU, object code has the jumps and inter-module references partially parametrized so that a linker can fill them in. An object file is assumed to begin at a specific ___location in memory, often zero. It contains information on instructions that reference memory, so that the linker can [[Relocation (computing)|relocate]] the code when combining multiple object files into a single program.
An assembler is used to convert assembly code into machine code (object code) A linker links several object (and library) files to generate an executable.
 
An [[assembler (computing)|assembler]] is used to convert [[assembly code]] into machine code (object code). A linker links several object (and library) files to generate an executable. Assemblers (and some compilers) can also assemble directly to machine code to produce executable files without the object intermediary step.<ref>{{cite web |last1=Fischer |first1=Charles N. |title=What do compilers produce? |url=https://pages.cs.wisc.edu/~fischer/cs536.s05/lectures/Lecture03.pdf |publisher=University of Wisconsin Madison |access-date=2 April 2024}}</ref>
 
==References==
Line 16 ⟶ 21:
[[Category:Machine code]]
 
[[ca:Codi objecte]]
[[cs:Objektový kód]]
[[de:Objektcode]]
[[et:Objektikood]]
[[es:Código objeto]]
[[fr:Code objet]]
[[gl:Código obxecto]]
[[ko:목적 파일]]
[[hsb:Objektowy kode]]
[[id:Kode objek]]
[[it:Codice oggetto]]
[[kk:Объектілік модуль]]
[[nl:Objectcode]]
[[ja:オブジェクトファイル]]
[[pl:Plik obiektowy]]
[[pt:Código objeto]]
[[ru:Объектный модуль]]
[[fi:Objektitiedosto]]
[[zh:目标代码]]