[LLVMdev] FunctionType as a function argument

Duncan Sands baldrick at free.fr
Mon Nov 29 11:02:54 PST 2010


Hi Salomon,

> FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C), cbFPtrArgs, false);

in spite of the name you gave it, this is not a pointer type.

> Function * func = cast<Function>(M->getOrInsertFunction(fName,
> Type::getInt32Ty(C), cbFPtrTy, Type::getInt8PtrTy(C), (Type *)0));

You need to pass a pointer-to-function type, not a function type.

Ciao,

Duncan.



More information about the llvm-dev mailing list