I made a little library for the IPhone that I would like to redistribute, but I cannot find how to compile it to work on both the simulator and the iphoneos. I know there is a way to build a lib.a for both architecture, but I cannot figure it out.
First you obviously have to put your code into a framework. That is fine for linking into your application that exists in the same project, but as you've noticed the iPhone doesn't support dynamic linking.
One of my libraries available on google code has a script that builds a Custom SDK for the iPhone and iPhone Simulator. I put the scripts to do that in the following StackOverflow answer. That also has the link to the code, so you can download and play with settings in the project if the post is not enough.