询问者
x86程序移植到x64后,“CPU采样”性能分析显示,clr.dll独占样本数最多,达到70%左右。但在x86下clr.dll独占样本数0.5%,这是为什么?

问题
全部回复
-
托管C++与调用非托管C++的函数,我的写法如下:
//托管C++函数
int
Cal_ManagedFun(array <unsigned
char
>^src,array <unsigned
char
>^dst)
{
//新建一个托管指针并开辟空间
IntPtr srcPtr = Marshal::AllocHGlobal(Marshal::SizeOf(src[0])*src.Length);
IntPtr dstPtr = Marshal::AllocHGlobal(Marshal::SizeOf(dst[0])*dst.Length);
//托管数组拷贝至托管指针
Marshal::Copy( src, 0, srcPtr, src.Length );
//托管指针转非托管指针,并写入算法参数
int
b = m_Impl->Cal_UnmanagedFun((unsigned
char
*)srcPtr.ToPointer(),(unsigned
char
*)dstPtr.ToPointer());
//托管指针拷贝至托管数组
Marshal::Copy(dstPtr, dst, 0, dst.Length);
//释放指针
Marshal::FreeHGlobal(srcPtr);
return
b;
}
-
crow321 你好,
OpenCV是第三方的图像处理库,超出了我们的支持范围。建议你到 OpenCV论坛寻求帮助。此贴将被移到一般问题讨论区。
感谢你的理解与支持。
Lisa Zhu [MSFT]
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.