I have a Managed C++ method defined in one of two
following ways (notice data is * in one case and & in the
other):
void virtual ReadData(System::Byte (* data) __gc[], int
timeOut) { /* bunch of code */ }
void virtual ReadData(System::Byte (& data) __gc[], int
timeOut) { /* bunch of code */ }
When I use ClassGenerator two generate this thing, if *
is used here is what generated for the call to that
method:
IL_0070: callvirt instance void [Utilities]
MammoVision.Utilities.ComPort.ComPort::ReadData
(unsigned int8[]&, int32)
When & is used code is:
IL_0070: callvirt instance void [Utilities]
MammoVision.Utilities.ComPort.ComPort::ReadData
(unsigned int8[]& modopt([Microsoft.VisualC]
Microsoft.VisualC.IsCXXReferenceModifier), int32)
As a result if I use & then the method in the original
class (that is being mocked) is called (instead of one
that is dynamically defined in Mock<Class> class).
Notes:
- I do understand that using & is not CLS compliant.
- MS C# compiler does support this Managed C++
extension.
- My guess would be that class generated by
ClassGenerator does not consider any MSC++ specific
options.
Regards,
Roman V. Gavrilov
Logged In: YES
user_id=397472
Roman,
You're right, ClassGenerator does not consider any specific
options for MSC++.
I will look at it this weekend, but may need your help in some
of the C++ specific stuff, as I am not much of a C++
programmer.
Thanks,
Griffin