locked
map DLL functions in C to C# RRS feed

  • Question

  •  

    Hello,

     

    I would like to map these function below in C to C#:

     

    typedef int SDK_RETURN_CODE;

    typedef unsigned int DEV_HANDLE;

    #ifdef SDK_EXPORTS

    #define SDK_API extern "C" __declspec(dllexport) SDK_RETURN_CODE _cdecl

    #define SDK_HANDLE_API extern "C" __declspec(dllexport) DEV_HANDLE _cdecl

    #else

    #define SDK_API extern "C" __declspec(dllimport) SDK_RETURN_CODE _cdecl

    #define SDK_HANDLE_API extern "C" __declspec(dllimport) DEV_HANDLE _cdecl

    #endif

     

    typedef TImageControl *PImageCtl;

     

    typedef struct {

    int Revision;

    // For Image Capture

    int Resolution;

    int BinMode;

    int XStart;

    int YStart;

    int GreenGain;

    int BlueGain;

    int RedGain;

    int MaxExposureTimeIndex;

    int ExposureTime;

    // For Image Rendor

    bool ImageRendorFitWindow;

    int Gamma;

    int Contrast;

    int Bright;

    int SharpLevel;

    bool BWMode;

    bool HorizontalMirror;

    bool VerticalFlip;

    // For Capture Files.

    int CatchFrames;

    bool IsAverageFrame;

    bool IsCatchRAW;

    bool IsRawGraph;

    bool IsCatchJPEG;

    bool CatchIgnoreSkip;

    } TImageControl;

     

    // Export functions:

    SDK_API MTUSB_InitDevice( void );

    SDK_HANDLE_API MTUSB_ShowOpenDeviceDialog( void );

    SDK_API MTUSB_GetModuleNo( DEV_HANDLE DevHandle, char *ModuleNo );

    SDK_API MTUSB_GetSerialNo( DEV_HANDLE DevHandle, char *SerialNo );

    SDK_API MTUSB_SetResolution( DEV_HANDLE DevHandle, PImageCtl SettingPtr);

    SDK_API MTUSB_GetCurrentFrame( DEV_HANDLE DevHandle, int FrameType, unsigned char *Buffer );

    SDK_API MTUSB_SetGPIOInOut( DEV_HANDLE DevHandle, unsigned char OutputByte,

    unsigned char *InputBytePtr );

     

    Thanks so much,

    Tammy

    Wednesday, June 6, 2007 9:52 PM

Answers