Solved

CTime usage in Window DLL?

Posted on 1997-07-19
3
501 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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…
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

21 Experts available now in Live!

Get 1:1 Help Now