going through mscorwrk.dll

  • Thread starter Thread starter Ian Lazarus
  • Start date Start date
I

Ian Lazarus

Greetings,



std::wstring s(L"hello world");

wchar_t c(L'x');

size_t i = s.find(c);



The assembly view of the above code shows that the call to s.find() is
actually a call into mscorwrk.dll which then calls the basic_string template
find() code. Why is it going through mscorwrk.dll? Can I coerce it to call
find() directly? The reason I'm on this is because there is a mistake. The
arg value "c" gets altered. It seems to be getting orred with 0x6400 inside
the mscorwrk code. Why is this happening?



Thanks
 
Ian Lazarus said:
Greetings,



std::wstring s(L"hello world");

wchar_t c(L'x');

size_t i = s.find(c);



The assembly view of the above code shows that the call to s.find() is
actually a call into mscorwrk.dll which then calls the basic_string
template find() code. Why is it going through mscorwrk.dll? Can I coerce
it to call find() directly? The reason I'm on this is because there is a
mistake. The arg value "c" gets altered. It seems to be getting orred
with 0x6400 inside the mscorwrk code. Why is this happening?



Thanks

0x6400 is your unicode x . You declared a wchar_t for c right?
The fact that the code path runs through mscorwks is because your managed
code calls unmanaged C code (the stl library function), this is called
thunking.

Willy.
 
Back
Top