3

Can I use const modifiers in IDL function definitions that get parsed by MIDL?

e.g.

    HRESULT TestFunctionCall(
        [in,string] const char *szParameter);

Or will that result in breakages somewhere down the track? It appears to make it through MIDL fine as far as the resulting _c.c and _s.c files go.

dlanod
  • 8,664
  • 8
  • 54
  • 96
  • This is good question. Yes, admittedly the answer is straight forward, as it is covered in the spec for MIDL, but it is none-the-less something many people don't consider when writing their interfaces in MIDL, and it is nice to see brought to attention. – WhozCraig Feb 12 '13 at 07:21

1 Answers1

4

The const modifier is part of the MIDL Language. Therefore you can use it at your interface definition.

harper
  • 13,345
  • 8
  • 56
  • 105
  • +1 Note: the list of things allowed to be declared `const` and the reasoning behind it is an interesting read. – WhozCraig Feb 12 '13 at 07:24