Recent Changes - Search:


edit SideBar

MCP Documentation


Currently, MCP has been tested on the following platforms:

  • Debian with GCC 4.5.3
  • Cygwin with GCC 4.5.3

However, it should work across most Linux distros with a GCC version that has plugin support.

MCP consists of three parts:

  • MCP GCC plugin (libmcp)
    • It parses your source file for managed classes / structs and creates intermediate files containing information about the layout of the managed objects.
  • MCP Driver1
    • It saves you the trouble of running GCC twice (once to parse with libmcp and once to actually compile) and eases usage of MCP.
  • MCP Runtime Library
    • At the moment, this is simply a header file (mcp.h).

1 The MCP driver is designed to be a direct replacement for calling gcc/g++ to compile your C++ source files. Once you have done setting up MCP, you will be able to simply call mcp instead of gcc/g++ to compile your source file with everything else in your build process remaining exactly the same. This allows for easy IDE integration or replacing gcc/g++ with mcp as your compiler in your Makefile.

Read more about it on the MCP Driver Documentation page.


MCP has the same GC performance as GCJ and Mono as all three employ Boehm GC in the same mostly precise mode. When compared to boost::shared_ptr / boost::shared_array in the worst case scenario, gc_ptr / gc_array are faster by more than an order of magnitude (disparity grows the more threads + CPU cores you have).

This is essentially because the former requires a lock (on systems like x86/x64, this is a locked increment instruction) for every pointer assignment and destruction. The latter (with GCC -O3 optimization) is no different to a raw native pointer for assign operations. Destructor is a simple assignment of zero to the stored native pointer.

Accesses (via the -> operator) and deferences are checked for null reference implicitly. This adds a little overhead that may be a problem for some. It is very unlikely though, as Microsoft STL now does bounds checks for every std::vector element accesses implicitly too. Furthermore, GCC -O3 only checks for null reference once for multiple deferences of the same object in the same scope. Even then, MCP allows you to opt out of the deference check by defining MCP_USE_CPP_NULL_DEREF_BEHAVIOR. This skips the null reference check and causes a null dereference to fall back to the default C++ behavior (segfault or exception handler etc.). It is envisioned that a derivative library then installs an exception handler that converts hardware exceptions for reads from address zero to a software exception (e.g. NullReferenceException).

MCP API Documentation

If you have not seen the Hello World Example, it is advisable that you take a quick look before jumping straight into the API documentation.

Otherwise, see the Managed C++ API Documentation page.

Edit - History - Print - Recent Changes - Search
Page last modified on November 21, 2012, at 12:42 AM