Open k-ye opened 2 years ago
Hi, I'm wondering if this replacement is effective. Since __cplusplus
is still defined even access in extern "C"
closure.
For example, in file taichi/runtime/llvm/runtime_module/runtime.cpp
, line 156 use extern "C"
and line 346 include context.h
.
if replace TI_RUNTIME_HOST
with __cplusplus
in taichi/program/context.h
. it will still try to complie the code in __cplusplus
closure and report an error templates must have C++ linkage
, which seems cannnot be handled
Right now we are using
#ifdef TI_RUNTIME_HOST
to provide CPP side functions forRuntimeContext
: https://github.com/taichi-dev/taichi/blob/c3631c09c1b2416f2e2740628acf78b7c06fb394/taichi/program/context.h#L35-L86. This can be replaced with a#ifdef __cplusplus
check. That way other part of the CPP codebase using this context will not have to defineTI_RUNTIME_HOST
anymore (https://github.com/taichi-dev/taichi/search?q=TI_RUNTIME_HOST).