Define TVM_FFI_DLL_EXPORT_TYPED_FUNC

Define TVM_FFI_DLL_EXPORT_TYPED_FUNC#

Define Documentation#

TVM_FFI_DLL_EXPORT_TYPED_FUNC(ExportName, Function)#

Export typed function as a SafeCallType symbol that follows the FFI ABI.

int AddOne_(int x) {
  return x + 1;
}

// Expose the function as "AddOne"
TVM_FFI_DLL_EXPORT_TYPED_FUNC(AddOne, AddOne_);

// Expose the function as "SubOne"
TVM_FFI_DLL_EXPORT_TYPED_FUNC(SubOne, [](int x) {
  return x - 1;
});

See also

ffi::TypedFunction

Note

ExportName and Function must be different, see code examples below.

Note

The final symbol name is __tvm_ffi_<ExportName>.

Parameters:
  • ExportName – The symbol name to be exported.

  • Function – The typed function.