Click to See Complete Forum and Search --> : Need Help: a wierd Managed C++ interop problem


leighpy
January 12th, 2007, 05:05 PM
I have a system written in native c++; The system calls to a COM component to perform some calculations. In one of the methods, I need to cast a struct as an array of bytes (BYTE *) and also passes the size of the array. It all works fine until I link the system to a static library which is written in C++/CLI. The input parameters to the COM method got messed up. It appears, the call tries to copy the input parameter data over (instead of using the passed in pointers). However, when copying the input data, it thinks the data is of only one byte instead of an array, so it copies one byte over and messes up the call. If I remove the linkage to the managed C++ library, the COM method call would use the original pointers. To note, there are no any relation or dependencies between the COM component and the managed C++ library.

I have no clue why linking to the managed C++ library would make the difference. Please help on any suggestions or hints. Thanks.