Using enums from other libraries as defaultvalues
Hello newsgroup,
I want to use the enum values of a third-party type library as
defaultvalues for my own interface. Unfortunately, this seems not to
work. The code for the test looks like this:
[
uuid(6A7B3B27-AE89-4255-8BEF-8B937FDD788B),
version(1.0)
]
library TestBaseLibrary
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(E0AFC11A-EFB3-405c-9C18-47ABEF1E4292),
v1_enum
]
enum ETestEnum
{
TEST_IDENTIFIER = 0
};
}
This library serves as a dummy for the third-party type library. If I
derive another library from this dummy library using the
importlib-directive, I can use the enum ETestEnum, but not its values:
[
uuid(35D8801C-9E59-4388-BCBA-D9FA41A50572),
version(1.0)
]
library TestDerivedLibrary
{
importlib("TestBaseLibrary.tlb");
[
object,
uuid(BED6D356-8546-482d-8F11-516BDBF43B72),
pointer_default(unique)
]
interface ITestInterface
{
[id(1)]
HRESULT TestMethod
(
[in, defaultvalue(TEST_IDENTIFIER)] enum ETestEnum MyEnum
// This yields the error message:
// .\TestDerivedLibrary.idl(19) : error MIDL2035 :
// constant expression expected
);
};
}
What am I doing wrong?
Thanks in advance,
Stuart