Generate a library and load it

To the best of my knowledge, the best documentation on this topic is here.
Please read Asterite’s comments and the replies to them.