views:

24

answers:

1

I have a static library built with 3.1.3. I'm including it into an application, which I'm building with 3.2/4.0b2.

The static library contains a UIViewController subclass, which in it's -init calls [super initWithNibName:nil bundle:nil].

This method in turn calls _doCommonSetup, which corrupts one of the subclass's ivars:

0x003a68e9  <+0014>  pop    %ebx
0x003a68ea  <+0015>  mov    0x8(%ebp),%esi
0x003a68ed  <+0018>  movl   $0x1,0x8(%esp)
0x003a68f5  <+0026>  mov    0x1d98327(%ebx),%eax
0x003a68fb  <+0032>  mov    %eax,0x4(%esp)
0x003a68ff  <+0036>  mov    %esi,(%esp)
0x003a6902  <+0039>  call   0x20e5f52 <dyld_stub_objc_msgSend>
0x003a6907  <+0044>  movl   $0x44898000,0x70(%esi)  <- corrupting subclass's ivar (setting it to 0x4489..)

I can use the static library fine with applications built with 3.0 or 3.1.3. But 3.2 and 4.0 cause problems.

Is this supposed to work, or can the static library be used only within apps that are build with same or older version of the SDK it was built with?

A: 

This was because 4.0 is using the modern runtime even on the simulator, while older versions were not. Compiled libraries are not compatible.

Jaka Jančar