[LLVMdev] Passing a pointer to a function
eli.friedman at gmail.com
Wed May 20 19:45:59 PDT 2009
On Wed, May 20, 2009 at 7:31 PM, Scott Ricketts <sricketts at maxentric.com> wrote:
> Where load_fcall is build using a call to Module::getOrInsertFunction
> as in the example here:
> My question is, what do I pass as the argument type for P above? The
> following seems to work, as long as there are no floating point ops:
I would suggest bit-casting p to an i8*.
> So I tried using just a void pointer type, as in:
> But then Type.cpp throws this assertion.
> Assertion `ValueType != Type::VoidTy && "Pointer to void is not valid,
> use sbyte* instead!"' failed.
Yeah, void* in C == i8* in LLVM. VoidTy is only used for function return types.
I'm not sure why you're getting crashes with the last approach; it
looks like it should work.
More information about the llvm-dev