Referencing an managed class from an unmanaged class?

  • Thread starter Thread starter Bruce
  • Start date Start date
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?
 
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

}


};
 
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
 
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?
 
Back
Top