<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hello Fabio,<br><br>You have to make a C wrapper for any C++ code due to "name mangling".  This usually looks something like:<br><br>extern "C" int mysum(int a, int b)<br>{<br>   return sum(a,b);<br>}<br><br>And then you declare it in the bitcode like this:<br><br>declare external i32 mysum(i32, i32)<br><br>Then you link both the wrapper and the C++ code in like you would any other linker library, noting the linking order is significant.<br><br>Note:  I haven't tested this I may have mistyped something in the commands since I'm typing from memory.<br><br>--Sam<br></div><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family:
 times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><b><span style="font-weight: bold;">From:</span></b> Fabio Kaminski <fabiokaminski@gmail.com><br><b><span style="font-weight: bold;">To:</span></b> llvmdev@cs.uiuc.edu<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, June 3, 2010 2:07:29 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [LLVMdev] call a extern C function<br></font><br>
<meta http-equiv="x-dns-prefetch-control" content="off">How can i interface llvm bitcode with a existent so library...<div><br></div><div>like when you use C prebuilt cos() or sin() ... suppose that i create a sum() in c/c++ compile a .so lib with it</div><div>and call it from "the bitcode" program... how can i do this?</div>
<div><br></div><div>Thanks</div><div><br></div><div>Fabio Kaminski</div>
<meta http-equiv="x-dns-prefetch-control" content="on"></div></div></blockquote>
</div><br>

      </body></html>