title: OS X: convert .dylib to .a/.o (dynamic to static)?
body: <p>Suppose I've read <a href="http://threadingbuildingblocks.org/wiki/index.php?title=Using_TBB#Is_there_a_version_of_TBB_that_provides_statically_linked_libraries.3F" rel="nofollow noreferrer">this caveat</a>, and I still want to use TBB as a statically-linked library. (Pretend I'm working in <a href="https://stackoverflow.com/questions/3723856/difference-between-static-and-dynamic-libraray-in-xcode-for-iphone">an environment</a> where users aren't allowed to create their own dylibs.) But I don't really want to rewrite the TBB makefile to generate libtbb.a instead of libtbb.dylib.</p>
  
  <p>Is there a simple command-line way to convert libtbb.dylib into libtbb.o with the same entry points?</p>
  
  <p>I have heard a good argument for not being able to go the <em>other</em> way, from static to dynamic. Namely: dynamic libraries need to be PIC, and converting a non-PIC static library to PIC isn't feasible. But that argument doesn't apply in the other direction, as far as I know.</p>
  
  <p><a href="https://stackoverflow.com/questions/2576910/how-to-convert-a-dynamic-dll-to-static-lib">Here's</a> someone saying it's impossible to convert .dll to .a on Windows, but I think they're just talking about the impossibility of breaking a .dll or .exe back up into its original .o files, not necessarily saying it would be impossible to create a linkable .o file with the same contents. Also, the situation on Windows is <a href="http://msdn.microsoft.com/en-us/magazine/bb985014.aspx" rel="nofollow noreferrer">slightly odder than "real" PIC</a>, although I don't think that's relevant.</p>