I created a new ATL project in Visual Studio 2015. I added a new simple ATL object, inside of the library I am trying to define a struct
so that I may pass this struct
around in my COM implementation. Here is my CerberusNative.idl
definition, with the added CerberusErrorDetails
structure:
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(B98A7D3F-651A-49BE-9744-2B1D8C896E9E),
dual,
nonextensible,
pointer_default(unique)
]
interface ICerberusSession : IDispatch{
};
[
uuid(8F2227F9-10A9-4114-A683-3CBEB02BD6DA),
version(1.0),
]
library CerberusNativeLib
{
[
uuid(527568A1-36A8-467A-82F5-228F7C3AC926)
]
typedef struct CerberusErrorDetails
{
INT ErrorCode;
BSTR ErrorMessage;
};
importlib("stdole2.tlb");
[
uuid(CAB8A88E-CE0E-4B4C-B656-C52A7C8A5B18)
]
coclass CerberusSession
{
[default] interface ICerberusSession;
};
};
When I try to compile it, I get the following error:
Error MIDL2312 illegal syntax unless using mktyplib compatibility mode : CerberusErrorDetails CerberusNative CerberusNative.idl 32
Am I doing something wrong? What is this mktyplib
error? Why is it asking for it?
Syntax was wrong. Correct way:
typedef
[
uuid(527568A1-36A8-467A-82F5-228F7C3AC926),
version(1.0)
]
struct CerberusErrorDetails {
INT ErrorCode;
BSTR ErrorMessage;
} CerberusErrorDetails;