[LLVMdev] import/export functions between Modules

edA-qa mort-ora-y eda-qa at disemia.com
Sat Nov 3 11:29:27 PDT 2012


I came up with this simple loop (import from base_module to module):

	auto & fl = base_module->getFunctionList();
	for( auto it = fl.begin(); it != fl.end(); ++it )
		module->getOrInsertFunction ( it->getName(), it->getFunctionType(),
it->getAttributes() );

I'm not positive this works. While I can resolve functions I then get an
error while trying to execute my entry function:

LLVM ERROR: Program used external function 'eval_expr' which could not
be resolved!


On 03/11/12 18:20, edA-qa mort-ora-y wrote:
> I'm having trouble figuring out how to export/import IR functions at the
> C++ API level. I think I've got the linking part figured out, but I need
> to get the functions exporting from one module into another. I see how I
> can iterate over the functions in one, but I'm not clear on how to
> expose this name/reference into the other module.
> 
> Is there a simple example/tutorial of this somehwere? Or can somebody
> give me the basic function calls?
> 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 


-- 
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/20121103/ee74e8ba/attachment.sig>


More information about the llvm-dev mailing list