Displaying 1 result from an estimated 1 matches for "addfn".
Did you mean:
addfb
2014 Oct 27
2
[LLVMdev] How to call a pointer that points to a C function
I have a pointer to a function that I need to invoke without going
through llvm::Module::getOrInsertFunction. This example does not work:
static int add(int x, int y);
llvm::Value *one, *two;
llvm::Constant* addfn
= llvm::ConstantInt::get(JB->getIntPtrTy(DataLayout), (intptr_t)add);
llvm::Type* args[] = { Int32Ty, Int32Ty };
llvm::FunctionType* ftype = llvm::FunctionType::get(Int32Ty, args);
addfn = llvm::ConstantExpr::getPointerCast(addfn, ftype);
CreateCall(addfn, one, two);
---
Is there a way? Or...