Solved

CTime usage in Window DLL?

Posted on 1997-07-19
3
502 Views
Last Modified: 2013-11-20
According to the documentation on CTime, because
CTime uses strftime(), it is not supported in Windows
DLLs. Is this limitation restricted to 16-bit DLLs?
Why this limitation?
0
Comment
Question by:rocco
3 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302685
I have used CTime in 32bit DLL's without any trouble. Iam not aware of this limitation under 16bit DLL's. What are you planning to do with Time in 16bit dll ?
0
 

Author Comment

by:rocco
ID: 1302686
I have no plans in using CTime in a 16-bit DLL, but I want
to make sure that something does not break because I got
lucky that is worked the first time. The documentation
states that I should not use this class in a DLL (it did
not state if 32-bit DLLs are safe). I remember something about
strtok() being unsafe in a medium memory model, but okay in
a large memory model. I am wondering if this special case
exist for strftime().

Thanks...
0
 
LVL 1

Accepted Solution

by:
kraken earned 50 total points
ID: 1302687
The deal with CTime is that strftime() is not re-entrant.  DLLs may be used by many programs at once on the system.  The code's ability to handle many different programs using it at once is known as re-entrancy.  Since strftime() is not re-entrant, you will work fine... maybe... for a while.  Detecting re-entrancy problems is always very difficult, since it has to do with timing and separate processes, sometimes separate applications.

Another major downside to CTime is that it is very limited.  You can't use it for birthdays, for example, because it only extends back to January 1, 1970 (unless, of course, you can guarantee that no one older than 26/27 is going to be stored on your application).

Use COleDateTime instead.  It sounds scarier, but it really isn't.  COleDateTime stores dates as double-precision floating points, and uses a set of specially-designed routines to ensure re-entrancy... and thread-safeness.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 119
Change owner from userA to server Local Administrators 7 59
NotAlone Challenge 20 79
mapBully challenge 6 113
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now