Compiler construction LLVM外部函数

Compiler construction LLVM外部函数,compiler-construction,llvm,extern,Compiler Construction,Llvm,Extern,我最近开始在MinGW下试验LLVM。我已经阅读了教程,但是现在我在外部函数方面遇到了问题 我声明的外部函数如下: const Type* doubleType = Type::getPrimitiveType(ctx, Type::DoubleTyID); std::vector<const Type*> doubleParams; doubleParams.push_back(doubleType); FunctionType* doubleDouble = FunctionTy

我最近开始在MinGW下试验LLVM。我已经阅读了教程,但是现在我在外部函数方面遇到了问题

我声明的外部函数如下:

const Type* doubleType = Type::getPrimitiveType(ctx, Type::DoubleTyID);
std::vector<const Type*> doubleParams;
doubleParams.push_back(doubleType);
FunctionType* doubleDouble = FunctionType::get(doubleType, doubleParams, false);
Function* SinFunction = Function::Create(doubleDouble, Function::ExternalLinkage, "sin", mod);
将SinFunction声明从使用“sin”更改为使用“my_cubic_transform”(不做任何更改),然后我得到:

LLVM ERROR: Program used external function 'my_cubic_transform' which could not be resolved
将我的makefile更改为包含“-g”选项无效。
万花筒教程建议这在LLVM中是可能的(至少对于我正在使用的JIT)。我做错什么了吗?如果是这样的话,那是什么?

没关系,我想出来了

事实证明,即使我使用的是可执行文件(exe)而不是dll,我也必须用uu declspec(dllexport)声明我的_cubic_转换


编写本教程的人一定使用过其他平台,而declspec不存在,因此没有发现这个问题。

没关系,我已经解决了

事实证明,即使我使用的是可执行文件(exe)而不是dll,我也必须用uu declspec(dllexport)声明我的_cubic_转换


编写本教程的人一定使用过其他平台,其中不存在declspec,因此没有发现此问题。

是的,可能是windows以外的任何平台:)是的,可能是windows以外的任何平台:)
LLVM ERROR: Program used external function 'my_cubic_transform' which could not be resolved