[LLVMdev] How to declare and use sprintf

Gordon Henriksen gordonhenriksen at mac.com
Sun Nov 25 16:40:47 PST 2007


On Nov 25, 2007, at 18:53, Jon Harrop wrote:

> So my Fib program is segfaulting and I'm not sure why. I think it  
> might be because my declaration and use of sprintf is wrong.
>
> I notice llvm-gcc produces declarations containing "..." like:
>
>  declare int %printf(sbyte*, ...)
>
> What is the correct way to do this?


The type you want is:

let sp = pointer_type i8_type in
   var_arg_function_type sp [| sp; sp |]

— Gordon





More information about the llvm-dev mailing list