[LLVMdev] Using a function from another module

Michael Muller mmuller at enduden.com
Sun Jan 10 11:23:48 PST 2010


Kenneth Uildriks wrote:
> On Sun, Jan 10, 2010 at 12:38 PM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote:
> > Won't passing llvm::Function* around vs strings (function names), also work, at code generation time,
> > without the need for a module A dec to module B impl. mapping?
> >
> > Garrison
> 
> Nope.  You cannot place a call instruction into one module whose
> callee is a Function from another module.  You have to put a
> declaration into the same module, and have your call instruction call
> that.  And then they need to be linked together, either by llvm-link
> or (if JITting) by addGlobalMapping.
> 

Actually, this is the first thing I tried, and the correct function does seem 
to get called - but it looks like the Verifier complains about it, which leads 
me to believe that there may be broader issues involved.


=============================================================================
michaelMuller = mmuller at enduden.com | http://www.mindhog.net/~mmuller
-----------------------------------------------------------------------------
Scnozwangers? Vermicious Knids? What kind of rubbish is that?
 - Mr. Salt, "Willy Wonka and the Chocolate Factory"
=============================================================================



More information about the llvm-dev mailing list