Calling a managed __gc class from a mixed mode dll, please help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a mixed mode dll with a garbage collected interface. The interface is
garbage collected because my derrived class has managed member variables. I
am trying to return a pointer to my interface using GetProcAddress and
calling an exported function which instantiates and returns my derrived
class. While this works for the native portion(also interfaces) of my DLL,
this fails with my managed class. The exception I receive is "Can not
marshal return value: The type definition of this type has no layout
information."

P.S. Sorry for the begging in the subject I just can't seem to find an answer.
 
Hello,
I have a mixed mode dll with a garbage collected interface. The interface is
garbage collected because my derrived class has managed member variables.

You can try to enwrap these managed members with gcroot<ManagedType*>
template.
While this allows to keep managed references, class remains native.
 
Back
Top