How to make a variable unique in the program?
- From: "bucher" <bucher@xxxxxxxx>
- Date: Thu, 11 Jan 2007 16:00:42 +0800
Hi,
Recently I downloaded a trace library from internet.
Here is some code:
//The user can't use XYTraceHelper directly
class XYTraceHelper
{
XYTraceHelper();
...
protected:
HANDEL m_hFile;
};
XYTraceHelper theHelper;
WRITETRACE(LPCTSTR szFormat, ...)
{
//save trace info into file
theHelper.Write(... );
}
In the constructor of XYTraceHelper the m_hFile will be initialized. And
because there is only one instance of XYTraceHelper (theHelper), all the
trace infomation will be wrote in a single file.
But if I use the library both in exe and dll, there woudle be two trace file
saved. This isn't what I want. I want to use the same "theHelper" in both
exe and dll. What should I do?
Thanks in advanced.
.
- Follow-Ups:
- Re: How to make a variable unique in the program?
- From: Igor Tandetnik
- Re: How to make a variable unique in the program?
- From: Alex Blekhman
- Re: How to make a variable unique in the program?
- Prev by Date: Re: Strange "Stack Overflow" message occurring with use of vector
- Next by Date: Re: Strange "Stack Overflow" message occurring with use of vector
- Previous by thread: Strange "Stack Overflow" message occurring with use of vector
- Next by thread: Re: How to make a variable unique in the program?
- Index(es):
Relevant Pages
|
Loading