Solved

Re-entrancy in DLLs

Posted on 1997-04-28
2
244 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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