Move load_extension() function into the core.