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 : . :)
|
|