mixing managed/unmanaged help

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?
 
J

Jochen Kalmbach [MVP]

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/
 
T

Tamas Demjen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top