CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    11

    Variable number of arguments in COM interface method

    Hello All,

    I have a method being declared in a COM Interface. I want this method to take variable number of arguments.

    Hence I declared the method as follows in the "IDL" file.
    LogMsg(long completionCode, long msgID, ...);

    But during compilation time it is giving me an error as follows...

    "cannot specify a variable number of arguments to a remote procedure : [ Parameter '...' of Procedure 'LogMsg' ( Interface 'IZLogger' ) ]"

    your help will be highly appreciated

  2. #2
    Join Date
    May 2002
    Location
    Russia
    Posts
    1,571
    Search the site by vararg keyword.

  3. #3
    Join Date
    Oct 2002
    Posts
    37
    With MIDL, you can use the "optional" keyword to specify arguments which are not required:

    Code:
    HRESULT MyFunc([in, optional] VARIANT Param1, 
                   [out, optional] VARIANT Param2)
    As far as I know, you cannot specify fully variable argument lists like in C++, at least not for non-inproc servers.

  4. #4
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    11
    Thanks for your suggestions guys,

    Is it possible to have variable list of arguments for in-proc servers. Please let me know cos I might have an option to convert it to in-proc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured