c ++ / cli方法签名限制 [英] c++/cli method signature limitation

查看:125
本文介绍了c ++ / cli方法签名限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道内部限制是什么对于c ++ / cli,方法签名是什么?b $ b?


我有一个混合程序集会抛出一个特殊的异常

函数(非常大的if-else控件)。它抛出一个

System.Runtime.InteropServices.MarshalDirectiveExc eption与

附加信息内部限制:方法签名太多

复杂或者太大了。当我将该函数编译为本机时,没有

问题。


TIA,

Sharon

解决方案

嗨沙龙

" dotnetchic" <做******** @ gmail.com>在消息中写道

news:11 ********************** @ q12g2000cwa.googlegr oups.com ...

任何人都知道内部限制是什么对于c ++ / cli,方法签名是什么?

我有一个混合程序集,它会抛出一个特定的
函数的异常(非常大的if-else控件) 。它会抛出一个
System.Runtime.InteropServices.MarshalDirectiveExc eption,附加信息内部限制:方法签名太复杂或太大。当我把这个函数编译为native时,没有
问题。

TIA,
Sharon




这看起来像一个非常有趣的bug。

你能告诉我MarshalDirectiveException的CallStack是什么吗?
给你的?

你能告诉我签名吗?关键功能?


Marcus


好吧,让我们看看......


方法签名(打开文件方法)如下所示:

int foo(FILE * file1,FILE * file2,CUSTOMSTRUCT1 custom1,CUSTOMSTRUCT2

custom2,unsigned short parm5,unsigned short parm6,unsigned short

parm7,int parm8,unsigned short& parm9)

{

//函数体= 1800 +行,大约1550行可执行代码

}


和抛出异常时的调用堆栈是:

KERNEL32.DLL!7c81eb33()

[以下框架可能不正确和/或缺失,没有符号已加载

KERNEL32.DLL]

KERNEL32.DLL!7c81eb33()

MyApp.exe!foo(...)

[外部代码]

MyApp.exe!OnFileOpen()第949行+ 0x35字节

[外部代码]

( ...然后几次调用mfc80d.dll进行消息传递...)


" dotnetchic"写道:

方法签名(打开文件方法)如下所示:
int foo(FILE * file1,FILE * file2,CUSTOMSTRUCT1 custom1,CUSTOMSTRUCT2
custom2, unsigned short parm5,unsigned short parm6,unsigned short
parm7,int parm8,unsigned short& parm9)
//函数体= 1800+行,大约1550行可执行代码
}




我会尝试将指针传递给两个自定义结构而不是

整个结构本身到函数。虽然编组人员应该能够处理9参数函数,但它可能会在结构上窒息。


Sean


Anybody know what the "internal limitation" of a method signature is
for c++/cli?

I''ve got a mixed assembly that throws an exception for one particular
function (very large if-else control). It throws a
System.Runtime.InteropServices.MarshalDirectiveExc eption with the
additional information "Internal limitation: method signature is too
complex or too large." When I compile the function as native, no
problem.

TIA,
Sharon

解决方案

Hi Sharon
"dotnetchic" <do********@gmail.com> wrote in message
news:11**********************@q12g2000cwa.googlegr oups.com...

Anybody know what the "internal limitation" of a method signature is
for c++/cli?

I''ve got a mixed assembly that throws an exception for one particular
function (very large if-else control). It throws a
System.Runtime.InteropServices.MarshalDirectiveExc eption with the
additional information "Internal limitation: method signature is too
complex or too large." When I compile the function as native, no
problem.

TIA,
Sharon



This looks like a very interesting bug.
Can you please tell me what the CallStack of the MarshalDirectiveException
gives you?
Can you please tell me the signature of the critical function?

Marcus


Well, let''s see...

method signature (open file method) looks like this:
int foo(FILE *file1, FILE *file2, CUSTOMSTRUCT1 custom1, CUSTOMSTRUCT2
custom2, unsigned short parm5, unsigned short parm6, unsigned short
parm7, int parm8, unsigned short &parm9)
{
// function body = 1800+ lines, roughly 1550 lines of executable code
}

and the call stack at the point the exception is thrown is:
KERNEL32.DLL!7c81eb33()
[Frames below may be incorrect and/or missing, no symbols loaded for
KERNEL32.DLL]
KERNEL32.DLL!7c81eb33()
MyApp.exe!foo(...)
[External Code]
MyApp.exe!OnFileOpen() Line 949 + 0x35 bytes
[External Code]
(... then several calls into mfc80d.dll for messaging ...)


"dotnetchic" wrote:

method signature (open file method) looks like this:
int foo(FILE *file1, FILE *file2, CUSTOMSTRUCT1 custom1, CUSTOMSTRUCT2
custom2, unsigned short parm5, unsigned short parm6, unsigned short
parm7, int parm8, unsigned short &parm9)
{
// function body = 1800+ lines, roughly 1550 lines of executable code
}



I would try passing pointers to the two custom structures instead of the
entire structures themselves to the function. While the marshaller should be
able to handle a 9-parameter function, it may be choking on the structures.

Sean


这篇关于c ++ / cli方法签名限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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