How can we use a native object inside a managed class RRS feed

  • Question

  • Hi,

    I have a c++/cx class with a native object as a private member, how can I use it from a method :

    public ref class ZipArchiveEntry sealed :  IArchiveEntry
    	libzippp::ZipEntry  _native;
            virtual IAsyncOperation<IRandomAccessStream^>^ LoadAsync();
    /*virtual*/ IAsyncOperation<IRandomAccessStream^>^ ZipArchiveEntry::LoadAsync()
    	return create_async([this]() -> IRandomAccessStream^
               // How can I access _native member variable?

    Instead of an object stored on the stack, should I use some kind of std::shared_ptr ? In this case will I be able to access
    the member variable ?

    Sunday, January 26, 2014 8:53 PM


  • If it's private, you can't access it externally... that's why you make it private.  Maybe I'm missing something.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by Vincent Rich Monday, January 27, 2014 3:39 PM
    Monday, January 27, 2014 2:49 PM