|
This is a known problem in the STL that comes with VC++6.0. See KB articles Q172396 and Q168958 for more details. In a nutshell, this has to do with how that STL implementation uses static data.
There are alternate STL implementations (like Dinkumware) that do not have this problem. At least, I think the old Dinkumware one you used to be able to purchase.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Both Cedric and James are right. There are two problems with your approach:
1) The version of STL you are using is broken. You can try fixes available here[^]: or pick some other implementation of the Standard Library that works with VC6.
2) Even when you get a good STL implementation, you'd better ensure that all the modules use the same instance of the CRT.
In short, I think it is a good idea to follow Herb Sutter's advice and make the dll entries C (not C++) functions.
|
|
|
|
|
Nemanja Trifunovic wrote: In short, I think it is a good idea to follow Herb Sutter's advice and make the dll entries C (not C++) functions.
I don't recall ever seeing Sutter saying that. Do you have a reference for it?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
I'll go back and re-read my copy to make sure. The reason I ask is because Sutter (along with Meyers) usually write about platform independent coding styles, so it would be unlike him to mention something specifically about DLLs. Especially since the same limitations are not placed on .so's in the *Nix world.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: I'll go back and re-read my copy to make sure.
I think you'll find it in the item 63. Use sufficiently portable types in a module’s interface. or somewhere around it in the Namespaces and Modules part of the book.
|
|
|
|
|
Hi,
Recently I started working in VS2005 instead of VS6.
In VS6 I could add member veriables to my class by using the class wizard.
In VS2005 I'm able to add only one member veriable at a time(i.e - for each
member veriable i need to right click over the form , choose the Add veriable , add the member veriable and choose the finish option(I can't add more than one veriable in one session).
Is there another quick way to do so?
Regards,
Eli
|
|
|
|
|
|
|
eli15021979 wrote: s there another quick way to do so?
Open the class' .h file and start typing. It's the fastest and easiest way to add member variables.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
When you click the class in class sheet, you'll see a property sheet. It is like the class wizard for adding message handlers and overwriting virtual functions.
If you use Dialog DDV/DDX, the adding variable members is for it.
|
|
|
|
|
I am about to have a go at writing my own service application. But before I start, I have a few questions I have unable to find reasonable answers to.
An article on CP states that a service is loaded at boot time before any users log on to the system. The service I intend to create is dependant on some system variables to be set which means the user is required to be logged on. This leads me to my question. Since the service requires the user to be logged on, I also want to be able to configure it for each user, which would probably require reading some HKCU registry keys. But how should I handle the case where more than one user is logged on, would the service be run as a seperate instance?
When installing the service, is it possible to do so without admin privlages?
|
|
|
|
|
The service runs in the context of a user so HKCU registry keys are of little/no help.
Running as a separate instance I don't think is possible.
Is there a way you can communicate with the service when a user logs on and send it the variables
it needs?
Otherwise, it sounds more like an app that runs in the background from the users Startup folder situation.
WalderMort wrote: When installing the service, is it possible to do so without admin privlages?
No.
Mark
|
|
|
|
|
Hi,
I wish to create .msg file by using Api calls without using MAPI...I have
all the details of mail item which can be get from .eml file...
Please suggest me where i can get the info for creating .msg files
without using MAPI and any third party tools should not be used...
Regards,
nag.
|
|
|
|
|
Hi,
I'm currently writing a small server application for data transfer. Two commands are for direct file transfer (relative path, e.g. test/data.dat) and I want to limit the filenames to be in the directory and subdirectories of the server application.
Let's say the server lies in c:\server\server.exe, now I want to be able to e.g. put a file into c:\server\new folder\test.dat, but not outside the server directoy, e.g. c:\test.dat (e.g. with a ../test.dat or new folder/../../test.dat).
Is there a good way to parse bad filenames/path?
Greetings
|
|
|
|
|
It is not clear what you need to do. I don't know what a "bad filenames/path" is. I am not sure if you must recognize incorrect syntax of if you need to allow access to something and not allow access to other things.
File access is typically controlled using the built-in features of the NTFS.
|
|
|
|
|
Per your subject, you need to read up on Access Control List (ACL). There's a whole API for it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
One way, if youv'e got absolute paths, just compare them as strings/char arrays.
You can get absolute paths by using _fullpath() or _wfullpath.
Then you can do the compare, something like this (beware! Old C syntax here):
NOTE! I didn't find the time to set current directory to c:\server before testing the code, so I made a full path name for goodRelPath. Else, I could have used a relative path for goodRelPath.
char * projectDir = "c:\\server\\";
char * goodRelPath = "c:\\server\\new folder\\test.dat";
char * badRelPath = "c:\\test.dat";
char tempFullPath[MAX_PATH];
_fullpath(tempFullPath, badRelPath, MAX_PATH );
if(strstr(tempFullPath, projectDir) == projectDir)
{
}
else {
}
_fullpath(tempFullPath, goodRelPath, MAX_PATH );
if(strstr(tempFullPath, projectDir) == projectDir)
{
}
else {
}
-- modified at 0:43 Tuesday 12th December, 2006
Better code...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Thank you for your help and the example. Great
|
|
|
|
|
I'm glad to be able to help you.
I have a faint memory of using this technique in a program system in the past (15 years ago, or even longer). It was in the DOS days, and there was a DOS call to convert a relative path to a canonical path name.
Well, the principle worked then, and should do so today.
Good luck.
Kakan
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi,
How many threads are there in a simple MFC dialog based Application.
Thanks in advance.
-- modified at 4:07 Tuesday 12th December, 2006
|
|
|
|
|
|
Can you spend a little more time thinking about what you need to ask?
|
|
|
|
|
vc++_fragrance wrote: Can anybody say...
I could but I doubt you'd be able to hear me!
There is at least one thread for any application, MFC or otherwise.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello folks,
I want to search all of files under some directory. For example, dir\file1.txt,
dir\file2.txt,
dir\file3.txt,
...
When using ::FindFirstFile and FindNextFile, I can get all files, and then I can process them. But because the processing may last long, I want to use multithread, but There are strage errors. Can ::FindFirstFile/FindNextFile be multithread? or Are they thread safe?
Thanks in advance.
Haifeng
|
|
|
|