C
cartoper
I am writing C# code that interacts with a external device's firmware
which is writen in C. There is a common enum file the firmware code is
using that I would like to consume in the C# world. I understand that
C# cannot use C header files directly, so I thought I could wrap the
enum file in a C++/CLI assembly. So I have done something like this:
------------------------------------
#ifdef __cplusplus_cli
namespace MyCompany::InstrumentCommsEnums
{
#endif
#define CT_MAXZONE 0x7
#define CT_MAXCHANNEL 0x8
#define CT_ADCCHANNEL 0xB
typedef enum toggleonoff{
TOG_OFF = 0,
TOG_ON = 1
}TOGGLEONOFF;
#ifdef __cplusplus_cli
}
#endif
------------------------------------
With hopes of getting to the toggleonoff enum this way:
MyCompany.InstrumentCommsEnums.toggleonoff.TOG_OFF
After referring the C++/CLI project in the C# code, there is no
MyCompany.InstrumentCommsEnums namespace. Any thoughts?
which is writen in C. There is a common enum file the firmware code is
using that I would like to consume in the C# world. I understand that
C# cannot use C header files directly, so I thought I could wrap the
enum file in a C++/CLI assembly. So I have done something like this:
------------------------------------
#ifdef __cplusplus_cli
namespace MyCompany::InstrumentCommsEnums
{
#endif
#define CT_MAXZONE 0x7
#define CT_MAXCHANNEL 0x8
#define CT_ADCCHANNEL 0xB
typedef enum toggleonoff{
TOG_OFF = 0,
TOG_ON = 1
}TOGGLEONOFF;
#ifdef __cplusplus_cli
}
#endif
------------------------------------
With hopes of getting to the toggleonoff enum this way:
MyCompany.InstrumentCommsEnums.toggleonoff.TOG_OFF
After referring the C++/CLI project in the C# code, there is no
MyCompany.InstrumentCommsEnums namespace. Any thoughts?