Re: passing a string to a dll
- From: "SteveR" <srussell@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Sep 2007 23:17:24 -0400
These comments about LPCTSTR in the DLL, how much do they apply to a shared
DLL? Not that mine is necessarily going to be shared, but that's the type I
chose by default when I created it. Is this also about overhead? Should I
avoid C++ as much as possible inside the DLL?
The real purpose of this particular DLL is to store thousands of
alphanumeric codes. Presently, I do this in a function in the exe, building
a large CStringArray to which each constant is added, e.g.,
array.Add(_T("K34TU79456T1") ); When a string (code) is passed to this
function, an iteration searches for that string in the array and returns a
bool value accordingly. The call occurs only once during the running of the
exe. This has been working very effectively, but perhaps not so
efficiently; I am not sure how to evaluate the performance other than that
the results are instantaneous and accurate.
If I move these strings into the DLL function, I will be happy to get them
out of the exe; but what impact does this have on performance, memory
consumption or anything else? Am I gaining or losing anything?
And if I move the alphanumeric code array to the DLL as I intend, how do I
build the array with LPCTSTR instead of CString?
------------
"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.
Also, you may want to define your functions for:
CString GetString();
CString LoadStringID(UINT stringID);
As
LPCTSTR GetString();
LPCTSTR LoadStringID(UINT stringID);
You can still assign to a CString on output:
CString cs = GetString();
Tom
.
- Follow-Ups:
- Re: passing a string to a dll
- From: Giovanni Dicanio
- Re: passing a string to a dll
- From: Joseph M . Newcomer
- Re: passing a string to a dll
- From: Scott McPhillips [MVP]
- Re: passing a string to a dll
- References:
- passing a string to a dll
- From: SteveR
- Re: passing a string to a dll
- From: Joseph M . Newcomer
- Re: passing a string to a dll
- From: SteveR
- Re: passing a string to a dll
- From: Tom Serface
- passing a string to a dll
- Prev by Date: Re: passing a string to a dll
- Next by Date: Re: Desktop Heap Size
- Previous by thread: Re: passing a string to a dll
- Next by thread: Re: passing a string to a dll
- Index(es):
Relevant Pages
|