So far, we've been looking at a simple program to try to see how methods are defined internally in compiled Swift 5.0 programs. In our simple example, essentially a hello world example printing from a small class, we have been able to find the class definition itself but we haven't been able to see where the methods are defined. We traced through the compiled program and found this:
__objc_class__TtC9swift_cmd7Printer_data:
0000000100002120 struct __objc_data {
0x80, // flags
16, // instance start
32, // instance size
0x0,
0x0, // ivar layout
aTtc9swiftcmd7p, // name
0x0, // base methods
0x0, // base protocols
__objc_class__TtC9swift_cmd7Printer_ivars, // ivars
0x0, // weak ivar layout
0x0 // base properties
}
But it doesn't have any associated method definitions. In Objective-C, there's a list of method descriptors that contain pointers to functions, so we expected to find the same thing here. We didn't.
from DZone.com Feed http://bit.ly/2VE4n8E
No comments:
Post a Comment