Solved

Re-entrancy in DLLs

Posted on 1997-04-28
2
239 Views
Last Modified: 2013-12-04

I am inserting a strtok function into a 16 bit DLL. strtok
accepts 2 arguments - argument 1 - the string in which the
token is to be found, and argument 2 the token itself.
However strtok can be called again and again to find multiple instances of the token in the same string - by
calling it with the 1st argument set to NULL.

I am facing problems w.r.t the above aspect i.e. looking
for the same token in the same string. If more than 1
application calls strtok and uses the above feature
and since I am using a "static char" variable to store
the original string - this feature gives erroneous results.

Any pointers will be greatly appreciated.
Thanks

0
Comment
Question by:Arun042597
2 Comments
 
LVL 2

Accepted Solution

by:
mnguyen021997 earned 100 total points
ID: 1396961
if i recall correctly, strtok itself uses a static variable to store previous finds.  you will probably need to write your own strtok function to achieve what you are looking for, passing in a store pointer to be updated by the function so it can rememberwhat previous finds it had encountered
0
 

Author Comment

by:Arun042597
ID: 1396962
Actually I should've put forth my question a bit more clearly :

My strtok is written the way strtok is supposed to be - using
the static variable to store previous finds.

The question is, how to handle this if more than one application
calls my strtok DLL to find a token again and again ..
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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

911 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

23 Experts available now in Live!

Get 1:1 Help Now