blob: 48114515318d22c5658a492be58b170492a7b144 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<div class="subsection-level-extent" id="Modern-GNU-Objective-C-runtime-API"> <div class="nav-panel"> <p> Next: <a href="traditional-gnu-objective-c-runtime-api" accesskey="n" rel="next">Traditional GNU Objective-C Runtime API</a>, Up: <a href="gnu-objective-c-runtime-api" accesskey="u" rel="up">GNU Objective-C Runtime API</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Modern-GNU-Objective-C-Runtime-API"><span>8.1.1 Modern GNU Objective-C Runtime API<a class="copiable-link" href="#Modern-GNU-Objective-C-Runtime-API"> ¶</a></span></h1> <p>The GNU Objective-C runtime provides an API which is similar to the one provided by the “Objective-C 2.0” Apple/NeXT Objective-C runtime. The API is documented in the public header files of the GNU Objective-C runtime: </p> <ul class="itemize mark-bullet"> <li>
<samp class="file">objc/objc.h</samp>: this is the basic Objective-C header file, defining the basic Objective-C types such as <code class="code">id</code>, <code class="code">Class</code> and <code class="code">BOOL</code>. You have to include this header to do almost anything with Objective-C. </li>
<li>
<samp class="file">objc/runtime.h</samp>: this header declares most of the public runtime API functions allowing you to inspect and manipulate the Objective-C runtime data structures. These functions are fairly standardized across Objective-C runtimes and are almost identical to the Apple/NeXT Objective-C runtime ones. It does not declare functions in some specialized areas (constructing and forwarding message invocations, threading) which are in the other headers below. You have to include <samp class="file">objc/objc.h</samp> and <samp class="file">objc/runtime.h</samp> to use any of the functions, such as <code class="code">class_getName()</code>, declared in <samp class="file">objc/runtime.h</samp>. </li>
<li>
<samp class="file">objc/message.h</samp>: this header declares public functions used to construct, deconstruct and forward message invocations. Because messaging is done in quite a different way on different runtimes, functions in this header are specific to the GNU Objective-C runtime implementation. </li>
<li>
<samp class="file">objc/objc-exception.h</samp>: this header declares some public functions related to Objective-C exceptions. For example functions in this header allow you to throw an Objective-C exception from plain C/C++ code. </li>
<li>
<samp class="file">objc/objc-sync.h</samp>: this header declares some public functions related to the Objective-C <code class="code">@synchronized()</code> syntax, allowing you to emulate an Objective-C <code class="code">@synchronized()</code> block in plain C/C++ code. </li>
<li>
<samp class="file">objc/thr.h</samp>: this header declares a public runtime API threading layer that is only provided by the GNU Objective-C runtime. It declares functions such as <code class="code">objc_mutex_lock()</code>, which provide a platform-independent set of threading functions. </li>
</ul> <p>The header files contain detailed documentation for each function in the GNU Objective-C runtime API. </p> </div> <div class="nav-panel"> <p> Next: <a href="traditional-gnu-objective-c-runtime-api">Traditional GNU Objective-C Runtime API</a>, Up: <a href="gnu-objective-c-runtime-api">GNU Objective-C Runtime API</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
<p class="_attribution-p">
© Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
<a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Modern-GNU-Objective-C-runtime-API.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Modern-GNU-Objective-C-runtime-API.html</a>
</p>
</div>
|