Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在按照这个 repo为 DolphinDB 编写一个插件,我想传递一个用户定义的函数,如下所示:
在 cpp 中:
extern "C" ConstantSP funcInCpp(Heap* heap, vector<ConstantSP>& arguments);
在 DolphinDB 脚本中:
loadPlugin("...") def g(x) { return x + 1 } funcInCpp(g)
我怎样才能正确地做到这一点?
您的脚本没有任何问题。在您的插件代码中,请将 ConstantSP 转换为 FunctionDefSP。