Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ffi/src/ffi/extra/library_module_system_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,25 @@ class SystemLibrary final : public Library {
explicit SystemLibrary(const String& symbol_prefix) : symbol_prefix_(symbol_prefix) {}

void* GetSymbol(const String& name) final {
// The `name` might or might not already contain the symbol prefix.
// Therefore, we check both with and without the prefix.
String name_with_prefix = symbol_prefix_ + name;
return reg_->GetSymbol(name_with_prefix);
void* symbol = reg_->GetSymbol(name_with_prefix);
if (symbol != nullptr) {
return symbol;
}
return reg_->GetSymbol(name);
}

void* GetSymbolWithSymbolPrefix(const String& name) final {
// The `name` might or might not already contain the symbol prefix.
// Therefore, we check both with and without the prefix.
String name_with_prefix = symbol::tvm_ffi_symbol_prefix + symbol_prefix_ + name;
void* symbol = reg_->GetSymbol(name_with_prefix);
if (symbol != nullptr) {
return symbol;
}
name_with_prefix = symbol::tvm_ffi_symbol_prefix + name;
return reg_->GetSymbol(name_with_prefix);
}

Expand Down
Loading