diff --git a/lib/CppInterOp/CppInterOp.cpp b/lib/CppInterOp/CppInterOp.cpp index 46f2fe226..0aba093cc 100755 --- a/lib/CppInterOp/CppInterOp.cpp +++ b/lib/CppInterOp/CppInterOp.cpp @@ -9,6 +9,8 @@ #include "CppInterOp/CppInterOp.h" +#include "CppInterOpRuntime.h" + #include "Compatibility.h" #include "clang/AST/Attrs.inc" @@ -3268,14 +3270,7 @@ TInterp_t CreateInterpreter(const std::vector& Args /*={}*/, } I->declare(R"( - namespace __internal_CppInterOp { - template - struct function; - template - struct function { - typedef Res result_type; - }; - } // namespace __internal_CppInterOp + #include "CppInterOpRuntime.h" )"); sInterpreters->emplace_back(I, /*Owned=*/true); diff --git a/lib/CppInterOp/CppInterOpRuntime.h b/lib/CppInterOp/CppInterOpRuntime.h new file mode 100644 index 000000000..2e5b7fbe8 --- /dev/null +++ b/lib/CppInterOp/CppInterOpRuntime.h @@ -0,0 +1,19 @@ +#ifndef CPPINTEROP_RUNTIME_H +#define CPPINTEROP_RUNTIME_H + +// This header contains runtime utilities previously injected into the +// interpreter using I->declare(). It is now provided as a real header so that +// the interpreter can load it on startup. + +namespace __internal_CppInterOp { + +template +struct function; +template +struct function { + using result_type = Res; +}; + +} // namespace __internal_CppInterOp + +#endif // CPPINTEROP_RUNTIME_H