CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2001
    Location
    Ottawa, Canada
    Posts
    152

    Question Interoperability between COM client and .NET Server

    I am looking into the COM Interoperating Sample from MSDN:
    COM Client and .NET Server:

    msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconexposingnetframeworkcomponentstocom.asp

    The .NET Server defines ILoan interface which is implemented by Loan class in C#.
    The function "ComputePayment" defined and implemented as follows:
    namespace LoanLib {

    public interface ILoan {
    ...
    double ComputeOpeningBalance();
    ...
    };

    public class Loan : ILoan {
    ...
    public double ComputePayment() {
    Payment = Util.Round(OpeningBalance * (Rate / (1 -
    Math.Pow((1 + Rate), - Term))), 2);
    return Payment;
    }
    ...
    };
    }

    Here is question:

    When this function is called from VC++ 6.0 client, the signature of this function is quite different.

    pILoan->ComputePayment(&payment);

    The return value is moved to the end of argument list. Can anyone explain
    why this is happening? Thanks

  2. #2
    Join Date
    Apr 2004
    Posts
    76
    Hi Bobby,

    Its COM. COM always returns a HRESULT (hopefully S_OK). The parameter that the client receives back (such as VB or VBScript) is passed as an [out, retval] parameter.

    See http://www.codeguru.com/forum/showthread.php?t=302058

    Jeff

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