Current Status ??

891 views
Skip to first unread message

John Barrett

unread,
Dec 24, 2012, 2:01:17 AM12/24/12
to mono...@googlegroups.com
I'm attempting to create a wrapper for the Ogre 3D engine, but I've gotten stalled by the lack of template support in the current mono/cxxi repo on github

Is there someone working on templates that could use a tester running cxxi against a fairly large scale project ??

Also I'm a bit confused... I see MSVC and Itanium support mentioned, but nothing about linux though there is extensive mention of Qt for testing... does linux also use the MSVC ABI ?? (Perhaps it would be better called the IntelX86 ABI ??).. I ask because I need the wrappers to work on windows, linux, and mac at minimum, with hopefully iOS and android support at some point.

João Matos

unread,
Dec 24, 2012, 12:07:29 PM12/24/12
to asce...@gmail.com, mono...@googlegroups.com
On Mon, Dec 24, 2012 at 7:01 AM, John Barrett <asce...@gmail.com> wrote:
I'm attempting to create a wrapper for the Ogre 3D engine, but I've gotten stalled by the lack of template support in the current mono/cxxi repo on github

Is there someone working on templates that could use a tester running cxxi against a fairly large scale project ??

I am working on a version of Cxxi that uses Clang as a parser and should be able to support templates correctly. This is not yet ready for general usage though.

Also I'm a bit confused... I see MSVC and Itanium support mentioned, but nothing about linux though there is extensive mention of Qt for testing... does linux also use the MSVC ABI ?? (Perhaps it would be better called the IntelX86 ABI ??).. I ask because I need the wrappers to work on windows, linux, and mac at minimum, with hopefully iOS and android support at some point.
 
There are only two major C++ ABIs: MS and Itanium. The MS one is used by MSVC and Clang (when in MS ABI mode), and the Itanium one is used by GCC (even on Windows with MinGW) and Clang (as the default ABI).

At the moment Cxxi does not support running under iOS because it needs to generates IL code at runtime.

--
João Matos

Alex Corrado

unread,
Dec 24, 2012, 3:16:51 PM12/24/12
to mono...@googlegroups.com, asce...@gmail.com
Hey,

I am working on a version of Cxxi that uses Clang as a parser and should be able to support templates correctly. This is not yet ready for general usage though.

I think using Clang is the right idea going forward-- gcc-xml doesn't give us what we need for proper template support, among other things. Looking at your fork, it looks like you're using C++/CLI to bind Clang? I'd be interested to hear more about your experience with this. It looks like you had to patch Clang a bit? Was this mostly to get it to compile with Microsoft's toolchain?
 
There are only two major C++ ABIs: MS and Itanium. The MS one is used by MSVC and Clang (when in MS ABI mode), and the Itanium one is used by GCC (even on Windows with MinGW) and Clang (as the default ABI).

Yeah we could probably document this a bit better. Basically, MSVC is the ABI usually used on Windows (due to Microsoft's tools), and Itanium is the ABI usually used everywhere else (due to gcc).


At the moment Cxxi does not support running under iOS because it needs to generates IL code at runtime.

I plan to change this in the new year. Generally, I think the upstream mono/cxxi repo needs to do some catchup.

Best,
Alex

João Matos

unread,
Dec 24, 2012, 5:13:59 PM12/24/12
to mono...@googlegroups.com
On Mon, Dec 24, 2012 at 8:16 PM, Alex Corrado <alexande...@gmail.com> wrote:
Hey,

I am working on a version of Cxxi that uses Clang as a parser and should be able to support templates correctly. This is not yet ready for general usage though.

I think using Clang is the right idea going forward-- gcc-xml doesn't give us what we need for proper template support, among other things.

Yeah, I agree. Clang is much nicer and gives accurate information for everything we need. Even documentation comments! :)
 
Looking at your fork, it looks like you're using C++/CLI to bind Clang?

That's right. It would probably be possible to use the libclang C API. I actually started the parser with the C API, but it does not have entry points for all the information we need, I extended it a bit but just gave up because it's generally harder to use than the C++ API, so I chose to use C++/CLI to bridge both worlds. This does limit the generator to the Windows platform at the moment... Good news is that I've been working on a C++/CLI compiler (http://mono.1490590.n4.nabble.com/C-CLI-compiler-td4657711.html), so eventually it should be able to run it, meanwhile I see no good solution to the the problem, other than trying to use the C API, or use the Clang XML dumpers, which I've never tried. 
 
I'd be interested to hear more about your experience with this. It looks like you had to patch Clang a bit? Was this mostly to get it to compile with Microsoft's toolchain?

Yes, I've been contributing fixes to Clang related to MSVC headers and MS ABI support. Without the patches Clang cannot parse VS2012 headers, or parse pointers-to-members of incomplete types. Basically I've been fixing stuff as I go to make it work with my projects. Most of the patches have been posted to the mailing lists, some have been applied, others should be applied soon.

Tracker bugs, in case you are interested:


Nice to see that you want to work more on the project, perhaps we should get a clear idea of the roadmap going forward. I'd really like to see the generator having support for multiple backends (I already started work on this), to be able to support Cxxi-style C# bindings, and also C++/CLI bindings.

On the runtime side of things, I think we should replace the C++ objects layout and name mangling with metadata generated from Clang, instead of trying to generate it at runtime. Even Clang can't get the MS-style name manglings totally right yet, so I don't think it's a good idea to replicate all that work in Cxxi.

--
João Matos

Daniel Ferreira Monteiro Alves

unread,
May 3, 2013, 4:48:05 AM5/3/13
to mono...@googlegroups.com
I am interested to see the progress of your work!

Some time ago I needed a way to create the bindings for Ogre and others C++ libraries, and with support for inheritance of classes in C++ directly from C#. Because I didn't have much time I created a reverse way, which is not practive I know, but I first defined the C# classes with some metadata, then after compiling these assemblies I generate another assembly that maps and creates the Bindings.

For C++ inheritance, because I could not change the pointers of the c++ method table directly, and I didn't know how to do it in a safe way for multiplatforms, I used a bidirectional call for the bindings (again, its not a good practive but worked).

There are some time that I worked with this, so I even don't remember some aspects of the implementation, but the code is here https://github.com/danfma/InVision.

I don't have much time for now but if possible I want help in a near future. :P

Daniel Ferreira Monteiro Alves

unread,
May 3, 2013, 4:54:20 AM5/3/13
to mono...@googlegroups.com
Ok, now I remembered. I created the bindings for each library manually and just generates the bindings for them automatically. It's not a way to go! :P
Reply all
Reply to author
Forward
0 new messages