Displaying 2 results from an estimated 2 matches for "cbfptrarg".
Did you mean:
cbfptrargs
2010 Nov 29
3
[LLVMdev] FunctionType as a function argument
Hi all.
I would like to declare a function that takes a function pointer as an
argument.
In C, it would be :
void execute(char (*func)(void*), void *param)
So, in my compiler, I have :
std::vector<const Type *> cbFPtrArgs(1, Type::getInt8PtrTy(C));
FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C), cbFPtrArgs,
false);
Function * func = cast<Function>(M->getOrInsertFunction(fName,
Type::getInt32Ty(C), cbFPtrTy, Type::getInt8PtrTy(C), (Type *)0));
But then I get an error form LLVM :
/home/sal...
2010 Nov 29
0
[LLVMdev] FunctionType as a function argument
...;salomon.brys at gmail.com>wrote:
> Hi all.
> I would like to declare a function that takes a function pointer as an
> argument.
> In C, it would be :
>
> void execute(char (*func)(void*), void *param)
>
> So, in my compiler, I have :
> std::vector<const Type *> cbFPtrArgs(1, Type::getInt8PtrTy(C));
> FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C),
> cbFPtrArgs, false);
> Function * func = cast<Function>(M->getOrInsertFunction(fName,
> Type::getInt32Ty(C), cbFPtrTy, Type::getInt8PtrTy(C), (Type *)0));
>
> But then I get a...