Quote:
Originally Posted by mentorbob
Nathan,
... Most library routines are not re-entrant. ...
Bob
|
hmmm, I checked the MCC 18 library and found a couple routines that are non-reentrant as they appear that they might use some globals (e.g. strtokpgmram), but the majority of the library, including print/put/etc., appears to be re-entrant friendly by using only auto variables. The compiler will use .tmpdata and other managed resources, per usual, but interrupt routines should be saving the appropriate ones as needed already.
Do you know for certain that the library is non-reentrant? That would be good info to know as there are many library calls used that are not directly called by the user, like FXM3232 which is used for long x long multiplication.
Its still not a good idea to call printf() from within an interrupt routine due to the time delays associated with outputing the formated data, but not being re-entrant doesn't appear to be a reason in this case. I easily could be wrong, but looking at printf, vprintf, etc down the call train didn't reveal any obvious globals being referenced that would make the routine non-reentrant.