MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

mathlink error handling inside :Begin: - :End:

  • To: mathgroup at
  • Subject: [mg109555] mathlink error handling inside :Begin: - :End:
  • From: olanilsson <per.ola.nilsson at>
  • Date: Wed, 5 May 2010 06:05:18 -0400 (EDT)


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:

:Function:      readexr
:Pattern:       ReadEXR[ s_String ]
:Arguments:     { AbsoluteFileName[s] }
:ArgumentTypes: { String }
:ReturnType:    Manual

: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++-



  • Prev by Date: Re: FortranForm
  • Next by Date: Re: Plot this?
  • Previous by thread: Re: DistributeDefinitions statement appears to create memory leak
  • Next by thread: Re: mathlink error handling inside :Begin: - :End: