Referencing an managed class from an unmanaged class?

B

Bruce

I need to fire an event from an unmanaged class. If I declare a pointer
to the managed class within the unmanaged class I get a compile error "

"cannot declare a managed 'm_pGps' in an unmanaged 'MyProgressNotifier'"


Any idea how I can do this?
 
B

Bruce

Here is what I need to do? I need top pass a pointer to the
MyProgressNotifier class to an unmanaged function. So the
MyProgressNotifier class cannot be managed. The NotifyTotal function
will be called from the mentioned unmanaged function.


class MyProgressNotifier : public GarXface4::progressNotifier
{

public:

MyProgressNotifier() :progressNotifier()
{


}


void NotifyTotal(int nTotal)
{
ProgressNotifier::NotifyTotal(nTotal);
// Fire managed event here

}


};
 
R

raylopez99

I have no idea Bruce. Though I don't code for a living, I would not
even mix unmanaged with managed code. Just start from a Tabula Rasa.

But do check something as fundamental as you are compiling with the
/clr option rather than /clr:safe option.

RL
 
B

Ben Voigt

Bruce said:
I need to fire an event from an unmanaged class. If I declare a pointer
to the managed class within the unmanaged class I get a compile error "

"cannot declare a managed 'm_pGps' in an unmanaged 'MyProgressNotifier'"


Any idea how I can do this?
 

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