sharing unmanaged object across managed borders

  • Thread starter Thread starter DaTurk
  • Start date Start date
D

DaTurk

Hi,

I'm trying to have a unmanaged object contatined in a a managed
class. THis is no problem, but I need access to this object in other
managed classes. I'm not sure how to do this. I mean, it wouldn't
really make sense to be able to pass in a unmanaged object into a
managed anything because it can be accessed via C#. Any help would be
appreciated.

Thank you in advance.
 
DaTurk said:
Hi,

I'm trying to have a unmanaged object contatined in a a managed
class. THis is no problem, but I need access to this object in other
managed classes. I'm not sure how to do this. I mean, it wouldn't
really make sense to be able to pass in a unmanaged object into a
managed anything because it can be accessed via C#. Any help would be
appreciated.

You can surely put pointers to unmanaged classes in a ref class, and declare
these as internal visibility so your other classes in the same assembly can
use them.

For access from outside the assembly, providing properties on the containing
ref class is probably the best approach. You may want to add an extra ref
class that does nothing other than wrap around the unmanaged data.
 
Back
Top