[cfe-dev] clang + managed c++...
João Matos
ripzonetriton at gmail.com
Sun Dec 30 14:48:15 PST 2012
On Sun, Dec 30, 2012 at 9:40 PM, Tarmo Pikaro <tapika at yahoo.com> wrote:
> Now I would like to add managed c++ support (and interfaces) with further
> wiring to C#.
>
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:
https://github.com/tritao/cxxi
Beware it is not fool-proof yet so you will probably need to fix some stuff
in case you go down that road.
So far I have experimented with cland.exe front end tool, but C# wiring
> would require dll.
>
> I have noticed that there exists libclang.dll - but it's interface did not
> opened to me (two test applications
> c-arcmt-test.exe / c-index-test.exe - did not understood what they do
> exactly.)
>
Using the libclang C API would be easier, and I have generated a C# binding
with my own bindings generator tool before.
> (question 1) My idea is to copy clang.exe's source codes directly to dll -
> but may be you can recommend me
> best approach for doing this dll ? In ideal world I would like to have one
> front end exe (like clang.exe)
> for testing compilation, and dll which is used by .exe. Dll exposes also
> managed C++ interfaces next to
> native C++ interfaces.
>
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:
https://github.com/tritao/cxxi/blob/master/src/Parser/Parser.cpp
> (question 2) Do you know best approach of enabling managed c++ support
> (/clr) within dll - does cmake support this
> already - preferably so that /clr support is enabled only on individual
> files, not on project level.
>
I was able to do this with CMake on an individual file level. It is a bit
hacky but should work:
https://github.com/tritao/clang/blob/master/lib/Sema/CMakeLists.txt#L55
> (question 3) Do you have or has anyone made support for parsing .vcproj /
> .vcxproj project files -
> so project files could be taken as an input directly ?
>
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.
> Btw - to commit any change into clang trunk - do I need developer account
> to svn ?
>
Yes, you can use the Git mirror to have your own code under source control
more easily though.
--
João Matos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121230/005e4994/attachment.html>
More information about the cfe-dev
mailing list