Difficulty with C API functions when converting for interop into C#

  api, c++, interop

I’m trying to use a C API’s functions in C# so far I could convert basic ones such as:

 int USB3_TerminateLibrary(void);

became

[DllImport("Camera.dll", EntryPoint = "USB3_TerminateLibrary", CallingConvention = CallingConvention.Cdecl)]
public static extern int USB3_TerminateLibrary();

But the rest of the API functions are extremely difficulty for me:

typedef void * CAM_HANDLE;

typedef void * BUFF_HANDLE;

typedef struct
{
    /*! Camera unique Identifier */
    char pcID[CAMERA_ID_MAX_LENGTH];
} tCameraInfo;


int USB3_OpenCamera(const tCameraInfo * pCameraInfo, CAM_HANDLE * hCamera);

int USB3_CloseCamera(CAM_HANDLE hCamera);

int USB3_WriteRegister(CAM_HANDLE hCamera, unsigned long ulAddress, const void * pBuffer, size_t * piSize);

I couldn’t find any tool which can convert it.

Source: Windows Questions C++

LEAVE A COMMENT