M
matthew breedlove
I have a Managed VC++ WinForms app in VC8 calling a member function of a
class in a native DLL.
My managed code is similar to this:
System::Void btnTest_Click(System::Object^ sender, System::EventArgs^ e) {
Receiver r;
std::vector<char> v;
v.push_back('A');
r.DoTest(v, 50);
}
The implementation of the method in my native DLL looks like this:
void DoTest(std::vector<char> test, int test2) { };
When I call the method, the vector looks to be corrupted when I break
the debugger in the native DLL, and the int parameter has an incorrect
value as well.
I've also tried this with std::string instead of std::vector. The string
ends up populated with garbage, and any other parameters of the method
are corrupted.
If I pass the first argument by reference (string or vector), it will
still appear corrupted, but the remaining parameters of the method
remain intact.
Any ideas what could be causing this? I doubt it's an issue with
calling convention, as changing the first parameter to a non-STL type
works as expected, and the remaining parameters are intact.
Thanks,
-Matthew
class in a native DLL.
My managed code is similar to this:
System::Void btnTest_Click(System::Object^ sender, System::EventArgs^ e) {
Receiver r;
std::vector<char> v;
v.push_back('A');
r.DoTest(v, 50);
}
The implementation of the method in my native DLL looks like this:
void DoTest(std::vector<char> test, int test2) { };
When I call the method, the vector looks to be corrupted when I break
the debugger in the native DLL, and the int parameter has an incorrect
value as well.
I've also tried this with std::string instead of std::vector. The string
ends up populated with garbage, and any other parameters of the method
are corrupted.
If I pass the first argument by reference (string or vector), it will
still appear corrupted, but the remaining parameters of the method
remain intact.
Any ideas what could be causing this? I doubt it's an issue with
calling convention, as changing the first parameter to a non-STL type
works as expected, and the remaining parameters are intact.
Thanks,
-Matthew