[LLVMdev] how create a pointer to FILE*

Tim Northover t.p.northover at gmail.com
Thu Jun 26 23:24:39 PDT 2014


Hi Eric,

On 27 June 2014 03:25, Eric Lu <eirc.lew at gmail.com> wrote:
> void _to_prof( FILE* ptrF);
>
> I do it within LLVM,  but I don't know how build the parameter type for
> FILE* ptrF.

The definition of the FILE type is handled by your platform's libc
implementation. It's not standardised in any way. That said, if all
you want to do is pass and return the "FILE *" (and not, say, allocate
one or inspect its internals) then passing an "i8*" works in all cases
I know about.

Strictly, it's undefined behaviour at the C level; but in practice all
CPUs and compilers make sure that kind of mismatch works, if only
because there's so much legacy code out there that does it.

Cheers.

Tim.



More information about the llvm-dev mailing list