mathlink error handling inside :Begin: - :End:
- To: mathgroup at smc.vnet.net
- Subject: [mg109555] mathlink error handling inside :Begin: - :End:
- From: olanilsson <per.ola.nilsson at gmail.com>
- Date: Wed, 5 May 2010 06:05:18 -0400 (EDT)
Hi, I have a small question about the mathlink-workings (I have gone through the documentation but can't seem to find an answer). I have an external mathlink/c++ program with the following signature: :Begin: :Function: readexr :Pattern: ReadEXR[ s_String ] :Arguments: { AbsoluteFileName[s] } :ArgumentTypes: { String } :ReturnType: Manual :End: :Evaluate: ReadEXR::usage = "ReadEXR[fn] reads an OpenEXR file and return its rgba channels." I thought I was clever when I used AbsoluteFileName, but I can't seem to detect any file-not-exist error. If I try to open a non-existent file a message is send to the kernel and printed in the frontend, but no error is found if I probe for MLError in my C++-code. Thus, my questions are: 1. Could I detect such an error already inside the Begin-End block, and if so abort execution at this point? Is this approach a good idea? 2. If not, how can (or should) I detect the error-state in the C++- code? Regards, Ola