How does Mach-O loader loads different NSString objects?

Posted by overboming on Stack Overflow See other posts from Stack Overflow or by overboming
Published on 2010-05-22T15:58:11Z Indexed on 2010/05/22 16:30 UTC
Read the original article Hit count: 241

Filed under:
|
|
|
|

I have known that If you define a bunch of @"" NSString objects in the source code in Mac OS. These NSStrings will be stored in a segment in the Mach-O library.

Section
sectname __ustring
 segname __TEXT
    addr 0x000b3b54
    size 0x000001b7
  offset 731988
   align 2^1 (2)
  reloff 0
  nreloc 0
   flags 0x00000000
reserved1 0
reserved2 0

If I hex dump the binary, they are aligned closely one by one with a 0x0000as separator. What I want to know is how does the loader in Mac OS X load these NSStrings when the program runs? Are they loaded simpily by recognize the 0x0000 separator or these is a string offset table elsewhere in the binary pointing to separate NSString objects? Thanks.

(What I really want to do is the increase the length of one of the NSString, so I have to know how the loader recognize these separate objects)

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about mac