[LLVMdev] clang: call extern function using JIT

Óscar Fuentes ofv at wanadoo.es
Tue Aug 17 20:30:17 PDT 2010


gafferuk <gafferuk at gmail.com> writes:

> Can someone pease tell me what I am doing wrong?

It is hard to say because you don't say what the problem is, but let's
try.

> Im trying to register an external function with the JIT, so can call
> functions in my music 
>
> application.
>
> Here my function
>
> int Execute(llvm::Module *Mod, char * const *envp) {
> 	llvm::InitializeNativeTarget();

It is not necessary to call InitializeNativeTarget each time. One is
enough.

[snip]

> 	llvm::FunctionType* ft = llvm::FunctionType::get(llvm::Type::getInt32Ty
>
> (llvm::getGlobalContext()),
> 		std::vector<const llvm::Type*>(0, llvm::Type::getInt32Ty
_______________________________________________^

You are creating a vector of Type's with *zero* elements, so the effect
of this is a FuntionType that takes zero arguments.

[snip]

Next time please be more explicit on the descripcion of the problem.




More information about the llvm-dev mailing list