From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gcc~13/method-signatures.html | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 devdocs/gcc~13/method-signatures.html (limited to 'devdocs/gcc~13/method-signatures.html') diff --git a/devdocs/gcc~13/method-signatures.html b/devdocs/gcc~13/method-signatures.html new file mode 100644 index 00000000..f9041538 --- /dev/null +++ b/devdocs/gcc~13/method-signatures.html @@ -0,0 +1,9 @@ +

8.3.3 Method Signatures

This section documents the encoding of method types, which is rarely needed to use Objective-C. You should skip it at a first reading; the runtime provides functions that will work on methods and can walk through the list of parameters and interpret them for you. These functions are part of the public “API” and are the preferred way to interact with method signatures from user code.

But if you need to debug a problem with method signatures and need to know how they are implemented (i.e., the “ABI”), read on.

Methods have their “signature” encoded and made available to the runtime. The “signature” encodes all the information required to dynamically build invocations of the method at runtime: return type and arguments.

The “signature” is a null-terminated string, composed of the following:

For example, a method with no arguments and returning int would have the signature i8@0:4 if the size of a pointer is 4. The signature is interpreted as follows: the i is the return type (an int), the 8 is the total size of the parameters in bytes (two pointers each of size 4), the @0 is the first parameter (an object at byte offset 0) and :4 is the second parameter (a SEL at byte offset 4).

You can easily find more examples by running the “strings” program on an Objective-C object file compiled by GCC. You’ll see a lot of strings that look very much like i8@0:4. They are signatures of Objective-C methods.

+

+ © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
+ https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Method-signatures.html +

+
-- cgit v1.2.3