http://msdn.microsoft.com/en-us/library/7d5ky2cf.aspx

解决方案 »

  1.   

    你用C#调用一下这个com就明白了
      

  2.   


    搜资料不认真,俺帮你搜吧。In order for the parameters to be marshaled, the marshaling logic needs to know the semantics of data transfer during the method invocation. The IDL specifies two attributes, [in] and [out], for this purpose. We have already seen them in passing.    An [in] attribute specifies that the data has to be transferred from the client to the server.    An [out] attribute specifies that the data has to be transferred from the server to the client.    An [in, out] combination specifies that the data has to be transferred from the client to the server and back to the client.
      

  3.   

    A parameter can be specified with any of these base types, or a pointer to a base type. MIDL recognizes these data types as intrinsic and generates marshaling code without requiring extra attributes other than [in] and [out].
      

  4.   


    我写了一个C#程序来调用:            Bar b = new Bar();
                IBar b1 = b as IBar;
                Console.WriteLine("Time+3hours=" + b1.AddDate(DateTime.Now));
                Console.WriteLine("Time+3hours=" + b1.AddDateIn(DateTime.Now);运行结果是打印了两行同样的内容啊。没看出差别来。
      

  5.   


    加[in]的性能好呢还是不加[in]的性能好?如果加了[in]就要有marshal,难道不加[in]就没有marshal了吗? 可是我用C#程序来调用发现不加[in]也可以啊,难道marshal不是必须的?还是我的理解有误? 谢谢。
      

  6.   


    加[in]的性能好呢还是不加[in]的性能好?如果加了[in]就要有marshal,难道不加[in]就没有marshal了吗? 可是我用C#程序来调用发现不加[in]也可以啊,难道marshal不是必须的?还是我的理解有误? 谢谢。不加会双向调度
      

  7.   


    加[in]的性能好呢还是不加[in]的性能好?如果加了[in]就要有marshal,难道不加[in]就没有marshal了吗? 可是我用C#程序来调用发现不加[in]也可以啊,难道marshal不是必须的?还是我的理解有误? 谢谢。不加会双向调度也就是说加[in]可以避免双向调度,对吧?
    我手上虽然有<<com技术内幕>><<com本质论>>之类的参考书,但是似乎没有找到书上哪里有说什么时候会单向调度,什么时候不会。按照你的说法,如果不指定[in]或者[out],是不是默认就成了[in,out]类型:An [in, out] combination specifies that the data has to be transferred from the client to the server and back to the client. 是这样的吗? 谢谢。