#86 pragma prefix confuses IDLToCLCompiler

open
5
2011-04-12
2011-04-07
Matthew Waller
No

A colleague of mine submitted this hack for this problem a while ago but it looks like it has not been addressed so I am raising a bug. If you have two idl files with differing #pragma prefix definitions and nothing else in the files except an include from one of the files to the other you will receive a "ParseException: invalid scope for using a #pragma prefix, only usable outside of a module declarations.". This is of course a simplified example of the problem experienced.

On invstigation it appears to be due to the prefix not being reset at the end of each file. Adding the following line after the "m_fileStream.Close();" on line 266 of IDLPreprocessor.cs seems to get around the issue. There is most likely a more elegant solution than just injecting a canceling #pragma prefix definition though.

line to add:
m_outputStream.WriteLine("#pragma prefix \"\""); // reset the prefix at the end of each new file so the next file does not inherit the prefix

Hope this helps.

Discussion

    • summary: pragma prefix confuses IDLToCSCompiler --> pragma prefix confuses IDLToCLCompiler
     
  • Hi,

    You're right this is quite an old issue. I've looked at "10.6.5.2 The Prefix Pragma" of CORBA spec, and it states that "An IDL file forms a scope for this purpose, so a prefix resets to the previous prefix at the end of the scope of an included file:
    // A.idl
    #pragma prefix “A”
    interface A {};

    // B.idl
    #pragma prefix “B”
    #include “A.idl”
    interface B {};

    The repository IDs for interfaces A and B in this case are:
    IDL:A/A:1.0
    IDL:B/B:1.0"

    So your solution of just clearing prefix at the end of each file isn't that good.
    I'll try to implement something closer to the spec in the spare time.

     
    • assigned_to: nobody --> alexfh