Finished general method for loading native libraries