c++ cli - Why does gcroot return System^? -


i have following code:

internal::managedinputdata ^getmanagedinputdata() const { return minputdata; }  private:     gcroot<internal::managedinputdata^> minputdata; 

and whatever reason compile-time error:

error c2440: 'static_cast' : cannot convert 'system::object ^' 'internal::managedinputdata ^' 

if comment out getter error goes away.

i can't figure out problem hours, please help.

the following code compiles without error:

#include <gcroot.h> namespace foo {   public ref class managedinputdata { };    class unmanagedclass   {   public:     managedinputdata^ getmanagedinputdata() const { return m_managedinputdata; }   private:     gcroot<managedinputdata^> m_managedinputdata;   }; } int main() {   foo::unmanagedclass u;   foo::managedinputdata^ m = u.getmanagedinputdata(); } 

so don“t see problem... maybe need show more code...

see documentation of gcroot


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -