Get the structure of the module associated to a library and set up the environment for export.