LLVM Create a PointerValue from c-side-ptr

来源:互联网 发布:hyde知乎 编辑:程序博客网 时间:2024/06/10 02:38
// Llvm doesn't let you create a PointerValue from a c-side ptr.  Instead// cast it to an int and then to 'type'.Value* CastPtrToLlvmPtr(Type* type, const void* ptr) {           Constant* const_int = ConstantInt::get(Type::getInt64Ty(context()), (int64_t)ptr);            return ConstantExpr::getIntToPtr(const_int, type);}
0 0
原创粉丝点击