G
Guest
I am trying to use my unmanaged c++ class library in managed classes.
So far everything seems to be ok, just passing on the __events from
unmanaged to managed code using the __hook functions is a mising link.
I am getting this code: error C3731: incompatible event 'void
sLib::CDataset::OnSetProgress(sLib::CProgressInfo &)' and handler 'void
SkyscanLibBase::CDataset:oLocalProgress(sLib::CProgressInfo &)'; event
source and event handler must have the same event type
The tricky part is that I cannot change the base unmanaged code, so I can
only change the managed class wrapper.
So how could I define the managed DoLocalProgress() function in order that I
and __hook this with the unmanaged OnSetProgress() event???
One problem might be that I used the same class name but in 2 different name
spaces. I am using the 2002 VC++ .NET.
Thanks in advance.
Olaf
------------------------------------------
Here is may managed class with the hook to __event void OnSetProgress
------------------------------------------
namespace SkyscanLibBase {
public __gc class CDataset
{
public: CDataset() {
m_pDataset=new sLib::CDataset();
__hook(&sLib::CDataset::OnSetProgress,m_pDataset,&SkyscanLibBase::CDataset::
DoLocalProgress);
}
public: ~CDataset() {
__unhook(&sLib::CDataset::OnSetProgress,m_pDataset,&SkyscanLibBase::CDataset
:oLocalProgress);
if (m_pDataset) delete m_pDataset;
m_pDataset=NULL;
}
public: void DoLocalProgress(sLib::CProgressInfo &aProgressInfo) {
SkyscanLibBase::CProgressInfo *ProgressInfo=new
SkyscanLibBase::CProgressInfo();
OnProgress(*ProgressInfo);
};
};
}
-------------------------
Here is my unmanaged class that has __event void OnSetProgress
-------------------------
namespace sLib {
[event_source(native)]
class CDataset: public CFiles {
public:
CDataset() {
}
~CDataset() {
}
__event void OnSetProgress(CProgressInfo &ProgressInfo);
}
}
So far everything seems to be ok, just passing on the __events from
unmanaged to managed code using the __hook functions is a mising link.
I am getting this code: error C3731: incompatible event 'void
sLib::CDataset::OnSetProgress(sLib::CProgressInfo &)' and handler 'void
SkyscanLibBase::CDataset:oLocalProgress(sLib::CProgressInfo &)'; event
source and event handler must have the same event type
The tricky part is that I cannot change the base unmanaged code, so I can
only change the managed class wrapper.
So how could I define the managed DoLocalProgress() function in order that I
and __hook this with the unmanaged OnSetProgress() event???
One problem might be that I used the same class name but in 2 different name
spaces. I am using the 2002 VC++ .NET.
Thanks in advance.
Olaf
------------------------------------------
Here is may managed class with the hook to __event void OnSetProgress
------------------------------------------
namespace SkyscanLibBase {
public __gc class CDataset
{
public: CDataset() {
m_pDataset=new sLib::CDataset();
__hook(&sLib::CDataset::OnSetProgress,m_pDataset,&SkyscanLibBase::CDataset::
DoLocalProgress);
}
public: ~CDataset() {
__unhook(&sLib::CDataset::OnSetProgress,m_pDataset,&SkyscanLibBase::CDataset
:oLocalProgress);
if (m_pDataset) delete m_pDataset;
m_pDataset=NULL;
}
public: void DoLocalProgress(sLib::CProgressInfo &aProgressInfo) {
SkyscanLibBase::CProgressInfo *ProgressInfo=new
SkyscanLibBase::CProgressInfo();
OnProgress(*ProgressInfo);
};
};
}
-------------------------
Here is my unmanaged class that has __event void OnSetProgress
-------------------------
namespace sLib {
[event_source(native)]
class CDataset: public CFiles {
public:
CDataset() {
}
~CDataset() {
}
__event void OnSetProgress(CProgressInfo &ProgressInfo);
}
}