| 759 | } |
| 760 | |
| 761 | paddle::framework::CustomParser* Load(const std::string& name, |
| 762 | const std::vector<SlotConf>& conf) { |
| 763 | #ifdef _LINUX |
| 764 | std::lock_guard<std::mutex> lock(mutex_); |
| 765 | DLHandle handle; |
| 766 | std::map<std::string, DLHandle>::iterator it = handle_map_.find(name); |
| 767 | if (it != handle_map_.end()) { |
| 768 | return it->second.parser; |
| 769 | } |
| 770 | |
| 771 | handle.module = dlopen(name.c_str(), RTLD_NOW); |
| 772 | if (handle.module == nullptr) { |
| 773 | VLOG(0) << "Create so of " << name << " fail, " << dlerror(); |
| 774 | return nullptr; |
| 775 | } |
| 776 | |
| 777 | CreateParserObjectFunc create_parser_func = |
| 778 | (CreateParserObjectFunc)dlsym(handle.module, "CreateParserObject"); |
| 779 | handle.parser = create_parser_func(); |
| 780 | handle.parser->Init(conf); |
| 781 | handle_map_.insert({name, handle}); |
| 782 | |
| 783 | return handle.parser; |
| 784 | #endif |
| 785 | VLOG(0) << "Not implement in windows"; |
| 786 | return nullptr; |
| 787 | } |
| 788 | |
| 789 | paddle::framework::CustomParser* Load(const std::string& name, |
| 790 | const std::vector<AllSlotInfo>& conf) { |
no test coverage detected