How do I call this c function in c# (unmarshalling return struct)?
I want to use c# interop to call a function from a dll written in c. I have the header files. Take a look at this: enum CTMBeginTransactionError { CTM_BEGIN_TRX_SUCCESS = 0, CTM_BEGIN_TRX_ERROR_ALREADY_IN_PROGRESS, CTM_BEGIN_TRX_ERROR_NOT_CONNECTED }; #pragma pack(push) #pragma pack(1) struct CTMBeginTransactionResult { char * szTransactionID; enum CTMBeginTransactionError error; }; struct CTMBeginTransactionResult ctm_begin_customer_transaction(const char * szTransactionID); How do I call ctm_begin_customer_transaction from c#. The const char * mapps well to string, but despite various