I am using getWSLINK()
(incorrectly documented as getWSTP()
) in my LibraryLink program to evaluate Message
, Print
, etc. and print debugging information, errors, warning and other things (see here).
After I made my processing functions abortable (AbortQ), I ran into a problem: if the WSTP handling functions were called while an abort was in progress, the WSTP connection somehow got broken for good. It wasn't usable anymore, not even after the abort has finished. MLClearError
didn't recover either.
Does anyone have experience with this and can you explain what is happening when we try to use WSTP functions from LibraryLink during an abort?
Is there any way at all to force processing the WS link and still Print
some information while an abort is in progress? (I am hopeful because of the existence of AbortProtect
.)
For now I put an if (libData->AbortQ()) return;
at the beginning of all these printing functions to avoid breaking the MathLink connection.
(This came up while working on LTemplate and the packages I use it in.)