Boris Jabes [MSFT]

Boris Jabes [MSFT] BorisJ

Niner since 2006


  • The Access Show: Access 2010 demo of Access Services and web databases

    I love that hat.

  • VC++ 2005: IDE Tips and Tricks

    jsampson, I totally agree! I hope people don't think I'm depressed or something Smiley It sure seems like I'm feeling down and my hair gets a fair amount of screen time... Ah well, the joys of C9!
  • VC++ 2005: IDE Tips and Tricks

    Trackerball, I was definitely not trying to skirt the issue, it's more that I was not always expecting those questions Smiley The short answer to your question is this:

    - a managed class (ref class A {}) can only hold pointers to native types
    - a native class (class B {}) can not hold a managed handle directly, instead you should use gcroot<T> as follows:

    #include <vcclr.h>
    using namespace System;

    class B {
       gcroot<String^> str;   // can use str as if it were String^
       B() {}

    int main() {
       B b;
       b.str = gcnew String("hello");
       Console::WriteLine( b.str );   // no cast required

    I hope that answers the question. If you want to learn more, I gave a talk about interop at Tech-Ed and I have some posts about it over at

    -- Boris