Link to home
Start Free TrialLog in
Avatar of Arun042597
Arun042597

asked on

Re-entrancy in DLLs


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

ASKER CERTIFIED SOLUTION
Avatar of mnguyen021997
mnguyen021997

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Arun042597
Arun042597

ASKER

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 ..