[LLVMdev] How to know the size of a 'long'?

Paul J. Lucas paul at lucasmail.org
Mon Aug 20 19:08:46 PDT 2012


AFAIK, if I want to call an external C function from IR code, I need to use Function::Create() to create a Function whose signature matches the external C function, then call ExecutionEngine::addGlobalMapping() to "bind" the LLVM Function to the external C function (right?).

Assuming that's correct, if the external C function is declared:

	void foo(long);

how can I know whether to call Type::getInt32Ty() or Type::getInt64Ty() when creating the argument types vector that will be passed to Function::Create()?  I.e., how do I know how big a C 'long' is on a given platform?

- Paul





More information about the llvm-dev mailing list