#include <tvm/runtime/c_backend_api.h>
#include <tvm/runtime/crt/func_registry.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*!
* \brief Module container of TVM.
*/
/*! \brief Entry point for the system lib module. */
const TVMModule* TVMSystemLibEntryPoint(void);
+#ifdef __cplusplus
+}
+#endif
#endif // TVM_RUNTIME_CRT_MODULE_H_
break;
default:
if (use_octal_escape) {
- stream << '0' + ((c >> 6) & 0x03) << '0' + ((c >> 3) & 0x07) << '0' + (c & 0x03);
+ stream << static_cast<unsigned char>('0' + ((c >> 6) & 0x03))
+ << static_cast<unsigned char>('0' + ((c >> 3) & 0x07))
+ << static_cast<unsigned char>('0' + (c & 0x07));
} else {
const char* hex_digits = "0123456789ABCDEF";
stream << 'x' << hex_digits[c >> 4] << hex_digits[c & 0xf];
decl_stream << "#include <tvm/runtime/crt/module.h>\n";
stream << "static TVMBackendPackedCFunc _tvm_func_array[] = {\n";
for (auto f : function_names_) {
- stream << " " << f << ",\n";
+ stream << " (TVMBackendPackedCFunc)" << f << ",\n";
}
+ stream << "};\n";
auto registry = target::GenerateFuncRegistryNames(function_names_);
stream << "static const TVMFuncRegistry _tvm_func_registry = {\n"
<< " \"" << ::tvm::support::StrEscape(registry.data(), registry.size(), true) << "\","
void CodeGenCHost::GenerateCrtSystemLib() {
stream << "static const TVMModule _tvm_system_lib = {\n"
- << " &system_lib_registry,\n"
+ << " &_tvm_func_registry,\n"
<< "};\n"
<< "const TVMModule* TVMSystemLibEntryPoint(void) {\n"
- << " return &system_lib;\n"
+ << " return &_tvm_system_lib;\n"
<< "}\n";
}