由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - Need Help: a very wierd Managed C++ interop problem
相关主题
[合集] Need Help: a very wierd Managed C++ interop problem[公告] DotNet 版的投票结果
Managed Code vs. Unmanaged Code恭喜away担任BF
C# on JVM?recommended ASP .NET books?
用DLL会快些吗?A question seeking answers
how to debug managed dll when called from unmanaged code[合集] can not run ASP by IIS 5.1 in WIN XP (转载)
[合集] MCAD等CERTIFICATE有助于找工作么?麻烦大家帮忙看看:cannot find dependency
open source dotNet IDE - Software Studio[转载] 申请.NET 版
memory usage[公告] DotNet 板的投票结果
相关话题的讨论汇总
话题: c++话题: managed话题: need话题: wierd话题: clr
进入DotNet版参与讨论
1 (共1页)
O*****l
发帖数: 13
1
DOTNET gurus, I really need your help on this wierd behavior.
We have a system written in native c++; The system calls to a COM component
to perform some calculations. In one of the methods, we need to cast a
struct as an array of bytes (BYTE *) and also passes the size of the array.
It all works fine until we link the system to a static library which is
written in Managed C++. The input parameters to the COM method got messed
up. It appears, the call tries to copy the input parameter data ov
k****i
发帖数: 1072
2
Can you make the managed c++ library a dynamic one so you don't need to link
it into the native c++ system?
My guess is that when you link the managed c++ lib into the native one, the
whole lib will be executed in CLR.

component
.
the

【在 O*****l 的大作中提到】
: DOTNET gurus, I really need your help on this wierd behavior.
: We have a system written in native c++; The system calls to a COM component
: to perform some calculations. In one of the methods, we need to cast a
: struct as an array of bytes (BYTE *) and also passes the size of the array.
: It all works fine until we link the system to a static library which is
: written in Managed C++. The input parameters to the COM method got messed
: up. It appears, the call tries to copy the input parameter data ov

O*****l
发帖数: 13
3
Kongzi, thank you so much for your reply. You were right, it works if I
build the library into dll. One thing I don't understand is, even if the
program runs under CLR as if I build the system into a mixed managed and
unmanaged code under C++/CLR, shouldn't the CLR know where are the native
code and where are the native code call into native code.
Anyway, it's very relieved to know a way to work around this problem. Thanks
. :)
k****i
发帖数: 1072
4
When you link managed code to unmanaged code, the linker might create a
wrapper class of the unmanaged code so the whole thing would be running in
CLR. I am not an expert on this so it's just my guess. Glad that it works
out for you.

Thanks

【在 O*****l 的大作中提到】
: Kongzi, thank you so much for your reply. You were right, it works if I
: build the library into dll. One thing I don't understand is, even if the
: program runs under CLR as if I build the system into a mixed managed and
: unmanaged code under C++/CLR, shouldn't the CLR know where are the native
: code and where are the native code call into native code.
: Anyway, it's very relieved to know a way to work around this problem. Thanks
: . :)

1 (共1页)
进入DotNet版参与讨论
相关主题
[公告] DotNet 板的投票结果how to debug managed dll when called from unmanaged code
open source dotNet IDE - sharpdevelop[合集] MCAD等CERTIFICATE有助于找工作么?
Maverick for dotnet: MVC for web publishopen source dotNet IDE - Software Studio
dotnet template engine - NVelocitymemory usage
[合集] Need Help: a very wierd Managed C++ interop problem[公告] DotNet 版的投票结果
Managed Code vs. Unmanaged Code恭喜away担任BF
C# on JVM?recommended ASP .NET books?
用DLL会快些吗?A question seeking answers
相关话题的讨论汇总
话题: c++话题: managed话题: need话题: wierd话题: clr