COM+ 的最大数量限制函数参数
我正在使用 Delphi 类型库创建 COM+ 应用程序。当我为一个函数调用创建 78 个参数时,出现访问冲突错误。我意识到 COM+ 函数的参数数量是有限制的。所以之后,我必须使用类型化结构/记录来打包参数。然后传递一条记录而不是多个简单数据类型参数。
您知道这个限制吗?您有什么建议?
我做了更多涉及结构/记录的测试,然后安装新组件并在调用它时收到错误:
我调用该函数:
ReturnVaule := Clients.updClient2(EmploymentApp.SessionID,
MyClientDetails,
dtLastModificationDate,
ClientServices,
ClientRequestors,
ClientQuestionnaires);
并且收到错误:
“空引用指针已传递给存根”
I was using Delphi Type Library to create a COM+ application. I got a access violation error when I created the number 78 parameters for one function call. I realized that there is a limitation for the number of parameters for the COM+ functions. So after, I have to use a typed structure/Record to package the parameters. Then pass a record instead of numbers of simple data type parameters.
Do you know about this limitation and what is your suggest?
I did more test as involved the Struct/Record, then I install the new component and get a error when I call it:
I call the function:
ReturnVaule := Clients.updClient2(EmploymentApp.SessionID,
MyClientDetails,
dtLastModificationDate,
ClientServices,
ClientRequestors,
ClientQuestionnaires);
and I get the error:
"A null reference pointer was passed to the stub"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不认为 Delphi 或 COM+ 中有任何这样的限制。我不确定是什么导致了您的错误,但我认为您需要更详细地描述您所做的事情。
无论如何,使用具有这么多参数的方法是不明智的。超过大约 4 或 5 个已经在拉伸它。将此事件视为一个温和的暗示,以更易于管理的方式重新思考您的设计。
I don't believe that there is any such limit in Delphi or COM+. I'm not sure what caused your error but I think you'd need to describe what you did in more detail.
No matter what, it is not sensible to have methods with that many parameters. More than about 4 or 5 is already stretching it. Take this incident as a gentle hint to rethink your design in a more manageable manner.
正如您所说,您可以使用类型库编辑器来声明您的记录类型,然后修改您的方法以使用该类型的参数。
编辑:来自类型库编辑器的示例屏幕截图:
来自类型库编辑器的类型库声明生成以下内容代码(摘录):
As you said, you can use the type library editor to declare your record type and then modify your method to use a parameter of that type.
Edit: Example screenshot from the type library editor:
The type library declarations from the type library editor generates the following code (excerpt):
最后,我使用 Variant 参数来传输大部分参数,然后将它们作为数组读取出来。它工作得很好,但要知道数组的索引映射到哪个参数并不容易。
At last, I use a Variant parameter to transfer most of the parameters, then read them out as a array. It works fine, but it is not easy to know the index of the array is mapping to which parameter.