mixing managed/unmanaged help

  • Thread starter Thread starter quat
  • Start date Start date
Q

quat

I am getting the error:

error C4368: cannot define 'd3dPP' as a member of managed 'FormEx::Form1':
mixed types are not supported

I am trying to mixed managed and unmanaged code (d3dPP is unmanaged, where
the form is managed). Can I not have an unmanaged instance in a managed
class?
 
Hi quat!
I am trying to mixed managed and unmanaged code (d3dPP is unmanaged, where
the form is managed). Can I not have an unmanaged instance in a managed
class?

If you declare it as "private" it should work...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
quat said:
I am getting the error:

error C4368: cannot define 'd3dPP' as a member of managed 'FormEx::Form1':
mixed types are not supported

I am trying to mixed managed and unmanaged code (d3dPP is unmanaged, where
the form is managed). Can I not have an unmanaged instance in a managed
class?

No you can not, at least not yet. Maybe in a future version of C++/CLI.

Right now you can have an unmanaged pointer inside a managed class:

ref class Managed
{
private:
// Native n; // error
Native* n; // OK
};

You have to allocate it with new, and delete it from the destructor and
from the finalizer.

Tom
 
Back
Top