473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

changed string.find() arg value

Hello,
A call to std::basic_string<wchar_t>::find(...) from within a class library
is not working as expected. The value passed to find is 0x61, but the value
it receives is 0xE961. What's happening? How do I fix this?
Thanks

// stack trace
msvcp71d.dll!std::basic_string<wchar_t,std::char_t raits<wchar_t>,std::allocator<wchar_t>
::find(_Ch='?' (0xE961), _Off=0x00000000)

mscorwks.dll!791befaf()
MyClassLibrary.dll!MyNamespace.MyClass.bar()
MyConsoleApp.exe!main()
MyConsoleApp.exe!mainCRTStartup()

// MyConsoleApp.cpp
#include "stdafx.h"
#include <string>
#using <mscorlib.dll>
#using "C:\MyClassLibrary.dll"
int _tmain()
{
MyNamespace::MyClass::Init();
MyNamespace::MyClass* foo = new MyNamespace::MyClass();
foo->bar();

return 0;
}

// MyClassLibrary.cpp
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "_vcclrit.h"
#include <string>
using namespace System;
namespace MyNamespace
{
public __gc class MyClass
{
public:

static void Init()
{
__crt_dll_initialize();
}

void bar()
{
std::wstring string = L"hello world";
size_t n = string.find(L'a');
}
};
}

// MyClassLibrary compile options
/Od /AI "C:\MyClassLibrary" /D "WIN32" /D "_DEBUG" /D "_WINDLL" /D "_MBCS"
/FD /EHsc /MDd /GS /Zc:wchar_t /GR /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3
/nologo /c /Zi /clr /TP /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\msco rlib.dll" /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Syst em.dll" /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Syst em.Data.dll"

// MyClassLibrary link options
/OUT:"C:\MyClassLibrary.dll" /INCREMENTAL /NOLOGO /DLL
/INCLUDE:"__DllMainCRTStartup@12" /DEBUG /ASSEMBLYDEBUG
/PDB:"C:\MyClassLibrary.pdb" /NOENTRY /FIXED:No mscoree.lib msvcrt.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
"\Program Files\Microsoft Visual Studio .NET 2003\Sdk\v1.1\Lib\mscoree.lib"
Nov 17 '05 #1
0 1046

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: MR | last post by:
Why does the string value assigned to the RequestElementName in the SoapDocumentMethodAttribute get changed? The value below with a colon is changed to the hex value surrounded by underscores....
3
by: awebguynow | last post by:
in other words, Can I make client side mod's before I submit a form and Post ? I guess its just a matter of cycling through the form elements and setting value to null (or empty string) for...
3
by: sherifffruitfly | last post by:
Hi, Here's a skeleton-handler of what I'm trying to do: private void editBbListView_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e) { string qEnabled = ""; string...
8
by: Martin Jørgensen | last post by:
Hi, I have a program that reads in a couple of numbers from files and then stores them with some latex-code but I'm not satisfied with the exponential output, as it takes up too many character...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.