Using MEF from C++.Net

Aug 4, 2009 at 12:21 PM

I would like to use MEF from C++.Net code, but I can't get the type of my contract into the Export statement

{Export(typeof(MyInterface)] does not work since typeof is not implemented and
{Export((MyInterface).GetType())] does nogt work because it is not an instatiated class

I tried using the stringversion ({Export("MyInterface"]) but that does not work because than the default-type is used which obviously is not MyInterface.

Is it impossible (given the current state) is it going to be possible?
Suppose I want to implement this behaviuor and I succeed to circumpass this type issue is that the only issue or are there more to overcome?

Aug 4, 2009 at 4:10 PM

Hi Bert,

I'm not a C++/CLI user, but AFAIK the syntax looks like:


Where ::typeid is the C++/CLI equivalent of typeof().

Hope this does the trick!


Aug 4, 2009 at 4:20 PM

Actually I think what you are looking for is __typeof(MyInterface), which is an extension to managed c++

Aug 4, 2009 at 4:27 PM

Actually after further investigation Nick is correct typeid is the way to go, __typeof has been deprecated.

Aug 4, 2009 at 7:27 PM

Hello Guys,

Indeed the "::typeid" did the trick.
Thanks very much