[LLVMdev] trying to understand linkage with linker
edA-qa mort-ora-y
eda-qa at disemia.com
Sun Nov 4 03:08:04 PST 2012
If I create a function in a module with:
auto f = module->getOrInsertFunction( "eval_expr", ...)
//create function
Then later I link this with other modules:
Linker link;
link.LinkInModule( base_module );
link.LinkInModule( module );
Then I create an execution engine something like:
auto ee = EngineBuilder( link.getModule() )...create();
If I attempt to run the function directly I get an error:
ee->runFunction( f, args );
"LLVM ERROR: Program used external function 'eval_expr' which could not
be resolved!"
But if I get the same function from the linked module it works:
ee->runFunction( link.getModule()->getFunction( "eval_expr" ), args )
I'm trying to understand why. Once linked, are the source modules for
the linker in any way related to the result module, or is all data
copied and the source modules left alone? If this is true I can see that
somehow my "f" pointer simply isn't a function in the resulting module.
But perhaps somebody can explain it a bit better to me?
--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121104/bd74ab7b/attachment.sig>
More information about the llvm-dev
mailing list