diff --git a/include/CppInterOp/CppInterOpRuntime.h b/include/CppInterOp/CppInterOpRuntime.h new file mode 100644 index 000000000..22358fe44 --- /dev/null +++ b/include/CppInterOp/CppInterOpRuntime.h @@ -0,0 +1,22 @@ +//===--- CppInterOpRuntime.h - Runtime codes for language interoperability ---*- C++ -*-===// +// +// Part of the compiler-research project, under the Apache License v2.0 with +// LLVM Exceptions. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef CPPINTEROP_CPPINTEROPRUNTIME_H +#define CPPINTEROP_CPPINTEROPRUNTIME_H + +namespace __internal_CppInterOp { +template +struct function; + +template +struct function { + using result_type = Res; +}; +} // namespace __internal_CppInterOp + +#endif // CPPINTEROP_CPPINTEROPRUNTIME_H \ No newline at end of file diff --git a/lib/CppInterOp/CppInterOp.cpp b/lib/CppInterOp/CppInterOp.cpp index dd76109df..22d4b188a 100644 --- a/lib/CppInterOp/CppInterOp.cpp +++ b/lib/CppInterOp/CppInterOp.cpp @@ -3413,16 +3413,7 @@ TInterp_t CreateInterpreter(const std::vector& Args /*={}*/, if (GetLanguage(I) != InterpreterLanguage::C) { I->declare(R"( - namespace __internal_CppInterOp { - template - struct function; - template - struct function { - typedef Res result_type; - }; - } // namespace __internal_CppInterOp - )"); - } + #include sInterpreters->emplace_back(I, /*Owned=*/true);