B
Bruce
public ref class GpsDevice abstract
{
/* Please note GarXface4::GpsDevice* is in a different namespace
from this one and GarXface4::GpsDevice is an unmanaged class */
virtual GarXface4::GpsDevice* GetDevice() = 0;
};
I have a couple of classes inherited from that class.
public ref class GpsUsbDevice : public GpsDevice
{
/* Please note GarXface4::GpsDevice* is in a different namespace
from this one and GarXface4::GpsDevice is an unmanaged class */
GarXface4::GpsDevice* GetDevice()
{
return m_pDevice;
}
private:
GarXface4::GpsComPortDevice* m_pDevice; // GarXface4::GpsDevice is
the base class of this class
}
public ref class GpsComPortDevice : public GpsDevice
{
/* Please note GarXface4::GpsDevice* is in a different namespace from
this one and is an unmanaged class */
GarXface4::GpsDevice* GetDevice()
{
return m_pDevice;
}
private:
GarXface4::UsbDevice* m_pDevice; // GarXface4::GpsDevice is the base
class of this class
}
MyClass::CtreatDevice(GpsDevice^ p)
{
/* Please note GarXface4::GpsDevice* is in a different namespace
from this one and GarXface4::GpsDevice an unmanaged class */
GarXface4::GpsDevice pin_ptr *p = gpsDevice->GetDevice();
}
The compile error occurs on this line:
GarXface4::GpsDevice pin_ptr *p = gpsDevice->GetDevice();
and it seems to be caused by the pin_ptr. If I remove it, it works fine.
GarXface4::GpsDevice is an unmanaged class. Do I still need the
pin_ptr in 2005? Do pointers to unmanaged classes now automatically get
pinned?
{
/* Please note GarXface4::GpsDevice* is in a different namespace
from this one and GarXface4::GpsDevice is an unmanaged class */
virtual GarXface4::GpsDevice* GetDevice() = 0;
};
I have a couple of classes inherited from that class.
public ref class GpsUsbDevice : public GpsDevice
{
/* Please note GarXface4::GpsDevice* is in a different namespace
from this one and GarXface4::GpsDevice is an unmanaged class */
GarXface4::GpsDevice* GetDevice()
{
return m_pDevice;
}
private:
GarXface4::GpsComPortDevice* m_pDevice; // GarXface4::GpsDevice is
the base class of this class
}
public ref class GpsComPortDevice : public GpsDevice
{
/* Please note GarXface4::GpsDevice* is in a different namespace from
this one and is an unmanaged class */
GarXface4::GpsDevice* GetDevice()
{
return m_pDevice;
}
private:
GarXface4::UsbDevice* m_pDevice; // GarXface4::GpsDevice is the base
class of this class
}
MyClass::CtreatDevice(GpsDevice^ p)
{
/* Please note GarXface4::GpsDevice* is in a different namespace
from this one and GarXface4::GpsDevice an unmanaged class */
GarXface4::GpsDevice pin_ptr *p = gpsDevice->GetDevice();
}
The compile error occurs on this line:
GarXface4::GpsDevice pin_ptr *p = gpsDevice->GetDevice();
and it seems to be caused by the pin_ptr. If I remove it, it works fine.
GarXface4::GpsDevice is an unmanaged class. Do I still need the
pin_ptr in 2005? Do pointers to unmanaged classes now automatically get
pinned?