如何将IDL文件中的函数转换为C# [英] how to convert the function in IDL file to C#
本文介绍了如何将IDL文件中的函数转换为C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的idl文件中有[in,out,size_is(Size)] byte compress_page [*]参数。现在我们正在迁移到wcf。
你能不能告诉我我们如何转换成C#。
for ex:
在IDL文件中查看此函数
hi ,
i am having [in,out,size_is(Size)] byte compress_page[*] parameter in my idl file. now we are migrating to wcf.
can you please tell me know how we convert into C#.
for ex:
see this function in IDL file
long RMTReadMultiPages( [in] File fh,
[in, string] char prj[],
[in] long fileno,
[in] long extno,
[in] long pageStart,
[in,out] long *numPages,
[in] long transferSize,
[out] short *failCode,
[in,out,size_is(Size)] byte compress_page[*]
);
i必须用C#编写这个函数。
i have to write this function in C#.
I am trying to host my Wcf service with Entlib 5.0 Validation. When servie operation contracts go for validation they get crash. Whiel investigating, I found that ref keyword in Wcf service's operation giving this problem. E.g.:
Operation contract in service is like:
public void GetData(int ID, string name, ref string location) {};
Now, while validating string location, it gets crash and if I remove ref keyword it works fine.
Though, in EntLib version 4.0 there are no such issues.
i tried replacing "ref" with "out" the issue was solved..
that ref replacing with out means [in, out] replaced with out.. i am getting some junk values in "compress_page", i am suspecting that this because of When it acts as an input it taking junk values.
谢谢f
或您的合作预付
Thanks f
or advance for your coperation
推荐答案
此列表可能会给您一些帮助。
平台调用数据类型 [ ^ ]
[in]可以删除
[out]对应out
[in,out]可以是替换为ref
以下是对IDL的概述了解接口定义语言 [ ^ ]
Marshal Class [ ^ ]也可能有所帮助。
这是一个关于PInvoke的Wiki页面。 http://en.wikipedia.org/wiki/Platform_Invocation_Services [ ^ ]
PInvoke。 net [ ^ ]可以作为参考使用。 (但是,我现在无法访问该网站)
也许StackOverflow上的这个问题会给出一些线索:将接口IDL文件转换为C# [ ^ ]
或者这篇CP文章: Essential P / Invoke [ ^ ]
This list might give you some help.
Platform Invoke Data Types[^]
[in] can be removed
[out] corresponds toout
[in,out] can be replaced byref
Here is an overview over IDL Understanding Interface Definition Language[^]
The Marshal Class[^] might be of help too.
Here is a Wiki page about PInvoke. http://en.wikipedia.org/wiki/Platform_Invocation_Services[^]
PInvoke.net[^] can be good to use as a reference. (However, I cannot access the site at the moment)
Maybe this question at StackOverflow will give some clues: Convert Interface IDL file to C#[^]
Or this CP article: Essential P/Invoke[^]
这篇关于如何将IDL文件中的函数转换为C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文