473,325 Members | 2,671 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,325 software developers and data experts.

received arg value not equal to sent 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

// the arg passed in the next line is L'a' = 0x0061, but the value received
by the called string.find() routine is 0xE961.

<wchar_t> >::find(_Ch='?' [is 0xE961, should be 0x0061], _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";
// L'a' = 0x0061, but the value received by string.find() is 0xE961
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 699

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

Similar topics

1
by: a c s | last post by:
Hi there, my problem is as follows: When emailing a file using PHP 4.0.6, the attachment received is an empty "attachment.txt" file instead of the actual file I attached. Any suggestions why...
1
by: Patrick Dunnigan | last post by:
Hi, I am attempting a bulk copy from a c program into SQL Server 2000 using DBLib in freeTDS 0.63 RC11 (gcc 3.4.3, RH 9). I am getting an error message that I cannot find any documentation on. ...
4
by: John Vottero | last post by:
When a class contains a TimeSpan property, XmlSerializer doesn't work. A TimeSpan property is serialized like: <MySpan /> I've read a number of posts that talk about why this happens and how...
4
by: Dan McCollick | last post by:
Hi all, I am trying to retreive the number of bytes my app has currently received from an HTTPWebResponse. I understand that you can retreive the Content Length in the headers, but isn't this the...
5
by: Niall | last post by:
I'm experience problems very similar to those reported in this thread on dotnet.framework on May 16 at...
6
by: deltamami0999 | last post by:
I just received this e-mail from a colleague of mine that got stuck and she sent it to me and i'm stuck....we're wondering what this is all about.....can anyone help? Inventory Management...
27
by: cnixuser | last post by:
Hi, I am trying to write an application that will e-mail sales data reports once per day. I have largely succeeded in creating the application and I am able to e-mail my reports to some e-mail...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
1
by: poopsy | last post by:
hello I have been trying to send email to a group of users found in my database, but the problem is the email is being sent but not received. I have also tried sending only to one recipient, it does...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.