Re: passing a string to a dll



First, DID YOU USE THE DEBUGGER TO EXAMINE THE STRING CONTENTS???? If not, why not? I do
things like this all the time without problems, so there is something about your
environment that you are not telling us, but more critically, you have not actually
examined the behavior of the code.

Are you doing static linking of the MFC library? In that case, all bets are off. You
can't pass MFC objects across library boundaries. In this case, you would have to use
LPCTSTR.

Is the example you are using EXACTLY using the string "12345" or is it using something
else?

Given the example below, you should be comparing the binary value of the string (12345) to
the numeric value 12345, which is why I suspect that the example you have shown here may
not be the example you are actually using.

Note that you would nominally be better of passing const CString & s instead of CString s
in such a case; it would be more efficient.
joe
On Mon, 17 Sep 2007 21:34:09 -0400, "SteveR" <srussell@xxxxxxxxxxxxxxxxxxxxxx> wrote:

I am working with the first dll I've ever created. I am testing with this
function:

bool DLLRect::PullWhisker(CString s)
{
if(s != _T("12345") )
::Beep(1000,200);
return true;
}

In my view:

DLLRect r;
r.PullWhisker(_T("12345") );

Why am I getting that beep, i.e. why is the string not recognized?

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: question about catching TCLs output
    ... We have a debugger which is made of TCL and C languge, ... integrate has nothing to do with Eclipse, they(our IDE group members) use ... input and get its output to the display(I think this is standard output). ... BUT the result string built up with "Tcl_AppendElement" can't be caught. ...
    (comp.lang.tcl)
  • Re: Performance RPG Figurative Constants versus Literals
    ... in compilation times between the two methods, ... I would suspect that the compiler would store *blanks as a single byte ... I would also suspect that comparing ... a 132 character string to a figurative constant would be quicker in the ...
    (comp.sys.ibm.as400.misc)
  • Re: A more efficient way
    ... > Is there a more efficient way of comparing a string to different words? ... the limit," 20.17's suggestion leads to hashing schemes which ...
    (comp.lang.c)
  • Re: if question
    ... >> performed before comparing. ... > and boolean is the simplest type. ... Why convert the string to boolean? ...
    (microsoft.public.scripting.jscript)
  • Re: Strange strcmp() action?
    ... "Compares the C string str1 to the C string str2. ... This function starts comparing the first character of each string. ... It doesn't say anything about comparing the terminating null character ...
    (comp.lang.c)