Re: passing a string to a dll



OK, I figured it was worth asking :o)

I'd bet one of the files the linker is trying to use is not found so being ignored and references in it are causing the errors.

Tom

"SteveR" <srussell@xxxxxxxxxxxxxxxxxxxxxx> wrote in message news:ex5iO5j%23HHA.4784@xxxxxxxxxxxxxxxxxxxxxxx
Yes, in my view, where I call the DLL function, I have:

#include "Debug\TestDLL\DLLRect.h"
---------------------
"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote in message news:ujvemyj%23HHA.4880@xxxxxxxxxxxxxxxxxxxxxxx
Just a guess, but did you include the header file for the DLL.
---------------------
"SteveR" <srussell@xxxxxxxxxxxxxxxxxxxxxx> wrote in message news:Ohn3ONj%23HHA.4460@xxxxxxxxxxxxxxxxxxxxxxx
Thank you all for your help.

I have now specified unicode in the dll, so it should match up with the application.
I have, for now at least, chosen to use CString& in both the dll and the application.

Please remember that I am not nearly as trained in depth as you all are, and therefore cannot make complete sense of what I am now presented with:

Room 101View.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall DLLRect::PullWhisker(class CString &)" (__imp_?PullWhisker@DLLRect@@QAE_NAAVCString@@@Z)

My dll:

// DLLRect.h: interface for the DLLRect class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DLLRECT_H__935F1132_14D8_4CC5_A466_5B6E1904C9B4__INCLUDED_)
#define AFX_DLLRECT_H__935F1132_14D8_4CC5_A466_5B6E1904C9B4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class AFX_EXT_CLASS DLLRect
{
public:
DLLRect();
virtual ~DLLRect();
CString GetString();
CString LoadStringID(UINT stringID);
bool PullWhisker(CString& s); //LPCTSTR s);

};

#endif // !defined(AFX_DLLRECT_H__935F1132_14D8_4CC5_A466_5B6E1904C9B4__INCLUDED_)
. . .
bool DLLRect::PullWhisker(CString& s)
{
if(s != _T("12345") )
::Beep(1000,200);
return true;
}

my app:

// DLLRect.h: interface for the DLLRect class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DLLRECT_H__935F1132_14D8_4CC5_A466_5B6E1904C9B4__INCLUDED_)
#define AFX_DLLRECT_H__935F1132_14D8_4CC5_A466_5B6E1904C9B4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class AFX_EXT_CLASS DLLRect
{
public:
DLLRect();
virtual ~DLLRect();
CString GetString();
CString LoadStringID(UINT stringID);
bool PullWhisker(CString& s); //LPCTSTR s);

};

#endif // !defined(AFX_DLLRECT_H__935F1132_14D8_4CC5_A466_5B6E1904C9B4__INCLUDED_)
. . .
in my view:

DLLRect r;
CString s = _T("12345");
r.PullWhisker(s);



.



Relevant Pages

  • Re: passing a string to a dll
    ... I have, for now at least, chosen to use CString& in both the dll and the ... // DLLRect.h: ... Is the example you are using EXACTLY using the string "12345" or is it ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... CString LoadStringID(UINT stringID); ... You can still assign to a CString on output: ... I have now specified unicode in the dll, so it should match up with the application. ... // DLLRect.h: ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I have now specified unicode in the dll, so it should match up with the ... I have, for now at least, chosen to use CString& in both the dll and the ... // DLLRect.h: interface for the DLLRect class. ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... Why is there a header file in the Debug subdirectory? ... // DLLRect.h: interface for the DLLRect class. ...
    (microsoft.public.vc.mfc)

Loading