Displaying 1 result from an estimated 1 matches for "getintptrty".
Did you mean:
getint8ptrty
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 must I call getOrInsertFunction?
Before anyon...