Solved

Re-entrancy in DLLs

Posted on 1997-04-28
2
238 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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
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: …

771 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

11 Experts available now in Live!

Get 1:1 Help Now