I have a .DLL and a .h file. I'm using c#, but the .DLL is written in C++. I have to problem with calling certain function within the .DLL. The problem comes when I need to call functions that have types defined in them . For example include with the .DLL was a .h file and it has a type defined like follows:
struct device_info {
HANDLE dev_handle; // valid open handle or NULL
wchar_t* product_string; // malloc'd string or NULL
wchar_t* serial_string; // malloc'd string or NULL
};
typedef struct device_info *PDEV_INFO;
I tried to run with it and created a structure like so:
[StructLayout(LayoutKind.Sequential)] public struct PDEV_INFO
{
unsafe void* dev_handle;
unsafe char* product_string;
unsafe char* serial_string;
}
My program just crashes I try to use any of those types. How would I define these types in C# or how can I reference types from a .h file? Even better would be the types defined somewhere in the .DLL and I'm just unaware. Thanks.