I’m trying to create PackedFunc manually for my baremetal app. Following the way calling below macro:
example.c
#include<tvm/runtime/packed_func.h>
int A_wrapper(blahblah);
TVM_DLL_EXPORT_TYPED_FUNC(A, A_wrapper_);
Linking the program complains**: undefined reference to `__dso_handle’.** I wonder where does it call dso_handle in stdlib?
The macro expands into:
#define TVM_DLL_EXPORT_TYPED_FUNC(ExportName, Function) \
extern "C" { \
TVM_DLL int ExportName(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, \
int* out_type_code) { \
try { \
auto f = Function; \
using FType = ::tvm::runtime::detail::function_signature<decltype(f)>::FType; \
::tvm::runtime::TVMRetValue rv; \
::tvm::runtime::detail::unpack_call_by_signature<FType>::run( \
f, ::tvm::runtime::TVMArgs(args, type_code, num_args), &rv); \
rv.MoveToCHost(out_value, out_type_code); \
return 0; \
} catch (const ::std::runtime_error& _except_) { \
TVMAPISetLastError(_except_.what()); \
return -1; \
} \
} \
}