On Sun, Dec 30, 2012 at 9:40 PM, Tarmo Pikaro <span dir="ltr"><<a href="mailto:tapika@yahoo.com" target="_blank">tapika@yahoo.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">Now I would like to add managed c++ support (and
 interfaces) with further wiring to C#.</div></div></div></blockquote><div><br></div><div>So you want to generate some wrappers to use the Clang C++ API from a .NET? In this case you might find useful the generator I have been working on: <a href="https://github.com/tritao/cxxi">https://github.com/tritao/cxxi</a></div>

<div><br></div><div>Beware it is not fool-proof yet so you will probably need to fix some stuff in case you go down that road. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="background-color:transparent"><span>So far I have experimented with cland.exe front end tool, but C# wiring would require dll.</span></div>

<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

<span>I have noticed that there exists libclang.dll - but it's interface did not opened to me (two test applications </span></div><div style="background-color:transparent"><span>c-arcmt-test.exe / c-index-test.exe - did
 not understood what they do exactly.)<br></span></div></div></div></blockquote><div><br></div><div>Using the libclang C API would be easier, and I have generated a C# binding with my own bindings generator tool before.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

<span>(question 1) My idea is to copy clang.exe's source codes directly to dll - but may be you can recommend me </span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

<span>best approach for doing this dll ? In ideal world I would like to have one front end exe (like clang.exe)</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

<span>for testing compilation, and dll which is used by .exe. Dll exposes also managed C++ interfaces next to </span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

native C++ interfaces.</div></div></div></blockquote><div><br></div><div>I would not even try to bind or make a matching .NET interface to the entire Clang C++ API. It will be a lot of work. Just create some interfaces to get the exact information you need and pass around the data to the managed side via C++/CLI. You can find an example of this here: <a href="https://github.com/tritao/cxxi/blob/master/src/Parser/Parser.cpp">https://github.com/tritao/cxxi/blob/master/src/Parser/Parser.cpp</a></div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

(question 2) Do you know best approach of enabling managed c++ support (/clr) within dll - does cmake support this </div><div style="background-color:transparent">already - preferably so that /clr support is enabled only on individual files, not on project level.</div>

</div></div></blockquote><div><br></div><div>I was able to do this with CMake on an individual file level. It is a bit hacky but should work: <a href="https://github.com/tritao/clang/blob/master/lib/Sema/CMakeLists.txt#L55">https://github.com/tritao/clang/blob/master/lib/Sema/CMakeLists.txt#L55</a></div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

(question 3) Do you have or has anyone made support for parsing .vcproj / .vcxproj project files - </div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">

so project files could be taken <span style="background-color:transparent">as an input directly ?</span></div></div></div></blockquote><div><br></div><div>Yes, I have worked on this particular problem in GSoC 2010 for the Mono project. You can find code in MonoDevelop's repo for parsing Visual Studio solutions and projects, along with open-source MSBuild support to build them.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">

Btw - to commit any change into clang trunk - do I need developer account to svn ?</div></div></div></blockquote><div><br></div><div>Yes, you can use the Git mirror to have your own code under source control more easily though.</div>

</div><div><br></div>-- <br>Joćo Matos