[Mono-list] Using exported C++ classes in managed code

Chris Howie cdhowie at gmail.com
Tue Apr 8 11:41:45 EDT 2008


On Tue, Apr 8, 2008 at 9:28 AM, Tim Howard <timothy.howard at gmail.com> wrote:
> Seems like there is an awesome opportunity there for some template magic. :)
> Thinking of the Boost.Python library makes me wish there was something
> similar for C#.

I've thought about writing something that would hook up to a C++
library dynamically at runtime, allowing multiple compiler
name-mangling rule sets, etc.  But the biggest issue here is other
stuff, like C++ exceptions.  You can't catch them from managed land,
so you *need* something to catch them in unmanaged land.  IIRC swig
takes care of this by try{}ing every call and throwing a managed
exception if something is caught (though I could be wrong).  If the
exception is not caught then your Mono process will just die, which is
not good.

So it's pretty much an unsolvable problem until we can catch C++
exceptions using IL.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Mono-list mailing list