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
18 changes: 15 additions & 3 deletions src/runtime/crt/common/crt_runtime_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,21 @@ int ModuleGetFunction(TVMValue* args, int* type_codes, int num_args, TVMValue* r

ret_value[0].v_handle = NULL;
ret_type_codes[0] = kTVMNullptr;
if (num_args != 3 || type_codes[0] != kTVMModuleHandle || type_codes[1] != kTVMStr ||
type_codes[2] != kDLInt) {
return 0;
if (num_args != 3) {
TVMAPISetLastError("ModuleGetFunction expects exactly 3 arguments");
return kTvmErrorFunctionCallNumArguments;
}
if (type_codes[0] != kTVMModuleHandle) {
TVMAPISetLastError("ModuleGetFunction expects first argument to be a Module");
return kTvmErrorFunctionCallWrongArgType;
}
if (type_codes[1] != kTVMStr) {
TVMAPISetLastError("ModuleGetFunction expects second argument to be a string");
return kTvmErrorFunctionCallWrongArgType;
}
if (type_codes[2] != kDLInt) {
TVMAPISetLastError("ModuleGetFunction expects third argument to be an integer");
return kTvmErrorFunctionCallWrongArgType;
}

mod = (TVMModuleHandle)args[0].v_handle;
Expand Down