COM ATL函数[in] [out] [in / out] [retval] [out / retval]参数类型有什么区别? [英] What is the difference between the parameters type COM ATL function [in] [out] [in/out] [retval] [out/retval] ?

查看:178
本文介绍了COM ATL函数[in] [out] [in / out] [retval] [out / retval]参数类型有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为retval用于向用户返回值并输入。但是我无法区分out和retval。我已经阅读了几篇文章,但却无法理解。任何人都可以帮我解释一下吗?

I think retval is used to return a value to the user & in is for input. But i cant differentiate between out & retval. I have gone through several articles but not able to understand it. can anyone explain it for me?

推荐答案

你好,

看看这些链接:

stackoverflow问题 [ ^ ]



MSDN链接::

link 1 [ ^ ]

link 2 [ ^ ]



hope这有帮助!!

check out these links :
stackoverflow questions[^]

MSDN links::
link 1[^]
link 2[^]

hope this helps !!


如果您在不使用任何包装器的情况下使用C / C ++进行编码,那么out和retval都会产生相同的效果。



如果你生成包装或使用其他语言,那么一个参数将成为函数的返回值。



If you code in C/C++ without using any wrapper stuff, then both out and retval would have the same effect.

If you generate wrappers or use other langages, then one argument would become the return vale of the function.

HRESULT Test([out, retval] int *rv) { ... }

将成为

would become

int Test() { ... }

并抛出一个出现错误时的异常(负HRESULT)。

and throw an exception in case of an error (negative HRESULT).


这篇关于COM ATL函数[in] [out] [in / out] [retval] [out / retval]参数类型有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆