[LLVMdev] Using a function from another module

Michael Muller mmuller at enduden.com
Fri Jan 8 16:49:12 PST 2010

Hi all,

I'm trying to use a function defined in one LLVM module from another module 
(in the JIT) but for some reason it's not working out.  My sequence of 
activity is roughly like this:

  1) Create moduleA
  2) Create moduleB with "func()"
  3) execEng = ExecutionEngine::create(
         new ExistingModuleProvider(moduleB));
  4) execute "func()" (this works fine)
  4) add "func()" to moduleA as a declaration (no code blocks) with External
  5) execEng->addModuleProvider(new ExistingModuleProvider(moduleA));
  6) run a function in moduleA that calls "func()"

I get:
  LLVM ERROR: Program used external function 'func' which could not be resolved!

I'm guessing I'm either going about this wrong or missing something.  Can 
anyone offer me some insight?

michaelMuller = mmuller at enduden.com | http://www.mindhog.net/~mmuller
We are the music-makers, and we are the dreamers of dreams
 - Arthur O'Shaughnessy

More information about the llvm-dev mailing list