在c++ /CLI中映射C/ c++数据类型

Mapping C/C++ Data Type In C++/CLI

本文关键字:c++ 数据类型 映射 CLI      更新时间:2023-10-16

我必须开始围绕现有的静态C库开发c++/CLI包装器。我在C库中遇到了许多枚举、类型和结构体。因为我是c++/CLI的新手,所以我想知道在c++/CLI中可以使用什么数据类型。

typedef struct _GC_DEVICE {
    TCHAR *ptszDevicePath;
    /// The human-readable name of the device.
    /// This member is never NULL.
    TCHAR *ptszFriendlyName;
    //Device Type
    GC_DEVICE_TYPE DeviceType;
    /// USB related information about the camera.
    GC_USB_DEVICE_INFO USBDevInfo;
} GC_DEVICE,*PGC_DEVICE;
enum GC_DEVICE_TYPE {
    GC_USB_DEVICE,
    GC_IP_DEVICE,
    GC_DEPTH_SENSING_DEVICE,
};
typedef struct _GC_USB_DEVICE_INFO {
    /// The vendor ID.
    WORD    wVendor;
    /// The product ID.
    WORD    wProduct;
    /// The product revision number.
    WORD    wRelease;
} GC_USB_DEVICE_INFO, *PGC_USB_DEVICE_INFO;

可以帮助我在c++/CLI中转换这些声明吗?

ref class GCDeviceWrapper
{
public:
    // operations with the GC_DEVICE instance
private:
    GC_DEVICE device_;
};