[LLVMdev] clang: call application function

gafferuk gafferuk at gmail.com
Sun Aug 15 00:38:44 PDT 2010


Ive tried the following code, but does not work.
What am I doing wrong?

// function I would like to call using JIT
 extern "C"
void yipee(double val)
{
	fprintf(stderr, "yipee!");
}


std::vector<const llvm::Type*> Double(1,
	  llvm::Type::getDoubleTy(llvm::getGlobalContext()));
  llvm::FunctionType *FT =
llvm::FunctionType::get(llvm::Type::getVoidTy(llvm::getGlobalContext()),
	  Double, false);

  llvm::Function *F = llvm::Function::Create(FT,
llvm::Function::ExternalLinkage);
  EE->addGlobalMapping(F, yipee);


gafferuk wrote:
> 
> im using code from the clang interpreter example.
> what code do I need to add so I can call functions in my main application?
> 
> Thanks.
> Paul.
> 

-- 
View this message in context: http://old.nabble.com/clang%3A-call-application-function-tp29439756p29440979.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list