<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Okay, I'll defintly look at Julia and Cling as a starting point.<div><br></div><div>Thanks!<br><br><div><hr id="stopSpelling">From: kfischer@college.harvard.edu<br>Date: Sun, 3 Jan 2016 13:43:24 +0100<br>Subject: Re: [cfe-dev] Using Clang to import C++ source in an interpreter<br>To: bhare8972@hotmail.com<br>CC: cfe-dev@lists.llvm.org<br><br><div dir="ltr">Hi there,<div><br></div><div>this is definitely possible, but you'll find that it's not entirely straightforward. As a starting point however,</div><div>I can point you to the two projects which do this already. Maybe you'll find the code useful.</div><div><br></div><div>One is the Julia C++ Interface at <a href="https://github.com/Keno/Cxx.jl" target="_blank">https://github.com/Keno/Cxx.jl</a> which uses Clang to import C++ into julia.</div><div>The other is CERN's Cling at <a href="https://github.com/root-mirror/root/tree/master/interpreter/cling" target="_blank">https://github.com/root-mirror/root/tree/master/interpreter/cling</a>.</div><div><br></div><div>There's some quirks to both of these. Cxx.jl for example doesn't include any of the JIT-related stuff, because it expects to just be able to hand off LLVM Function* pointers to the julia execution engine. Cling on the other hand includes a lot of stuff specific to CERN's usage of it in their ROOT framework.</div><div><br></div><div>I'd recommend you take a look at the two links and see if they are helpful. </div></div><div class="ecxgmail_extra"><br><div class="ecxgmail_quote">On Sun, Jan 3, 2016 at 1:47 AM, Brian Hare via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr"><br>I am working on an interpreter for a computer language of my own design, and I'd like to allow my language to directly import C++ files. <br><br>I need a clang libtool for a project I am working on. I need a function that can take in a file name of a C++ source or header file and return a structure that represents the structure of the source file. Many IDE's have a source tree that shows the global variables, functions, classes, etc... that are defined in a C++ file. I need a functional version of that. What would the best way of producing such a function be? Would I make a clang libtool? How would I structure the tool? Is there any code or tool that I could look at for guidance? <br><br>I have seen a number of the simple clang-tool examples online, but I have no idea how to extend them to do what I want. <br><br>Furthermore, once I get a tree of variables, functions, and such, is there some way to JIT compile the functions and call them passing data from my external program to the JITed functions and back again?<br><br>thanks,<br>Brian Hare<br> </div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div></div> </div></body>
</html>