2011-10-19 28 views
0

我必須開始圍繞現有靜態C庫開發C++/CLI包裝器。我遇到了C庫中的枚舉數,typedefs和結構數。由於我是C++/CLI的新手,我想知道在C++/CLI中可以使用哪種數據類型。映射C/C++數據類型在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; 

Can Any Body Help Me在C++/CLI中轉換這些聲明嗎?

+0

爲什麼使用C++/CLI?爲什麼不使用C#P/Invoke? – Simon

+0

@Simon:它的靜態C庫,所以我認爲C#P/Invoke僅適用於Dll。 –

回答

0
ref class GCDeviceWrapper 
{ 
public: 
    // operations with the GC_DEVICE instance 

private: 
    GC_DEVICE device_; 
}; 
相關問題