Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions lib/CppInterOp/CppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "CppInterOp/CppInterOp.h"

#include "CppInterOpRuntime.h"

#include "Compatibility.h"

#include "clang/AST/Attrs.inc"
Expand Down Expand Up @@ -3268,14 +3270,7 @@ TInterp_t CreateInterpreter(const std::vector<const char*>& Args /*={}*/,
}

I->declare(R"(
namespace __internal_CppInterOp {
template <typename Signature>
struct function;
template <typename Res, typename... ArgTypes>
struct function<Res(ArgTypes...)> {
typedef Res result_type;
};
} // namespace __internal_CppInterOp
#include "CppInterOpRuntime.h"
)");

sInterpreters->emplace_back(I, /*Owned=*/true);
Expand Down
19 changes: 19 additions & 0 deletions lib/CppInterOp/CppInterOpRuntime.h
Original file line number Diff line number Diff line change
@@ -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 <typename Signature>
struct function;
template <typename Res, typename... ArgTypes>
struct function<Res(ArgTypes...)> {
using result_type = Res;
};

} // namespace __internal_CppInterOp

#endif // CPPINTEROP_RUNTIME_H
Loading