[LLVMdev] How to declare and use sprintf
Jon Harrop
jon at ffconsultancy.com
Sun Nov 25 15:53:33 PST 2007
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*, ...)
but I'm not sure how to do this so I've used:
let sprintf =
declare_function "sprintf"
(function_type (pointer_type i8_type) [| pointer_type i8_type;
pointer_type i8_type;
i32_type |]) m in
which gives:
declare i8* @sprintf(i8*, i8*, i32)
What is the correct way to do this?
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e
More information about the llvm-dev
mailing list