What is the proper way to write a C MathLink function that returns nothing at all?

The following works, but I'm not sure if all this work is actually necessary:

The template file:

:Function:      fun
:Pattern:       fun[]
:Arguments:     {}
:ArgumentTypes: {}
:ReturnType:    Manual

The C code:

void fun() {
    MLPutSymbol(stdlink, "Null");

In short, here I set the return type to Manual and explicitly returned Null. Is this all necessary or is there a shorter way?


1 Answer 1


That's exactly what you do. You need to send something back to Mathematica, and the symbol Null is the sensible choice.

  • $\begingroup$ Hmm, and here, you were faster.. $\endgroup$
    – halirutan
    Jan 30, 2013 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.