MathGroup Archive 2002

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

Search the Archive

Re: Error handling with MathLink


a) you can manual return the symbol $Failed
   your function should have the ReturnType Manual
   this is typical sufficient when there are not
   more things that can go wrong
b) define a message with Evaluate

   :Evaluate: CFunctions::nomem="foo is out of memory"
    and use

    and clean the link to discard the result
c)  you can return always
    a list {errorCode,functionResult} to Mathematica
    and the Mathematica function generate the messages
    due to the errorCode or return the functionResult


"Y.A.Tesiram" wrote:
> G'day all,
> How do I return errors to Mathematica from a MathLink program?
> For e.g.
>         ...
>         ptr = malloc( HUGE_VAL );
>         if (ptr == NULL) {
>                 // How do I return an error value to mathematica here?
>         }
> Thanks
> Yas

  • Prev by Date: Re: Custom colors on a 3-d suface
  • Next by Date: RE: Re: Raising Contour Plot Graphics to 3D
  • Previous by thread: Re: Error handling with MathLink
  • Next by thread: Poincare sections