Re: MathLink: how do I wrap and call a subroutine that should return nothing
- To: mathgroup at smc.vnet.net
- Subject: [mg38999] Re: MathLink: how do I wrap and call a subroutine that should return nothing
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 24 Jan 2003 05:04:26 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <b0oq96$bk6$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, end you function with MLPutSymbol(stdlink,"Null"); and not with nothing. Mathematica expect always a result form a function call, because it is a functional language. Regards Jens "Matthew D. Langston" wrote: > > 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