MathGroup Archive 2003

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

Search the Archive

MathLink: how do I wrap and call a subroutine that should return nothing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38980] MathLink: how do I wrap and call a subroutine that should return nothing
  • From: "Matthew D. Langston" <langston at SLAC.Stanford.EDU>
  • Date: Thu, 23 Jan 2003 08:05:07 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

How do I wrap and call a C subroutine that should return nothing back to
Mathematica. I want to somehow specify a :ReturnType: of "None" or "Void",
but mprep doesn't recognize those tokens. If I specify "Manual" then my
Mathematica session just hangs waiting for an answer from my MathLink
program. Does MathLink have a function like MLPutEmptyPacket() that just
tells Mathematica "Expect nothing from this MathLink function. It's OK to
stop waiting and return to your command loop".

This is (part of) the template file I am using:


:Begin:
:Function: SetValue
:Pattern: SetValue[ value_?NumericQ ]
:Arguments: {value}
:ArgumentTypes: {Real}
:ReturnType: Manual
:End:

void SetValue ( double value )
{
    /*
     * Do something useful with value.
     * It doesn't make sense to return anything.
     */

    /* What goes here to keep Mathematica from hanging? */
}


How do I specify a true MathLink subroutine that doesn't return a value to
Mathematica? Thank you for your help.

Warmest regards, Matt




  • Prev by Date: Re: Combinatorica problem
  • Next by Date: Re: Combinatorica problem
  • Previous by thread: perturbing a constant in Para plots
  • Next by thread: Multivariate-T Simulation Problem