Wolfram Research製品ご購入サービスとリソース会社概要その他のWolframサイト
Mathematica > MathLink C言語関数 >
MathLink C 関数

MLPutFunction()

int MLPutFunction(MLINK link, const char *s, int n)
頭部がs という名前の記号によって与えられ,n 個の引数を取る関数を,link で指定されたMathLink 接続に置く.
  • MLPutFunction()を呼び出した後で,関数の引数を送信するために他のMathLink 関数を呼び出さなければならない.
  • MLPutFunction()はエラーがあると0を返し, 関数が成功すると0以外の値を返す.
  • MLError()を使うと,MLPutFunction()が不成功の場合にエラーコードを引き出すことができる.
  • MLPutFunction()MathLink ヘッダファイルmathlink.hの中で宣言される.
#include "mathlink.h"

/* put an Integrate[] expression to a link */

void f(MLINK lp)
{
    if(! MLPutFunction(lp, "Integrate", 2))
        { /* unable to put the function to lp */ }

    if(! MLPutFunction(lp, "Times", 2))
        { /* unable to put the function to lp */ }

    if(! MLPutFunction(lp, "Power", 2))
        { /* unable to put the function to lp */ }

    if(! MLPutSymbol(lp, "x", 1))
        { /* unable to put the symbol to lp */ }

    if( ! MLPutInteger(lp, 2))
        { /* unable to put the integer to lp */ }

    if(! MLPutFunction(lp, "Power", 2))
        { /* unable to put the function to lp */ }

    if(! MLPutFunction(lp, "Sqrt", 1))
        { /* unable to put the function to lp */ }

    if(! MLPutSymbol(lp, "x", 1))
        { /* unable to put the symbol to lp */ }

    if(! MLPutInteger(lp, -1))
        { /* unable to put the integer to lp */ }

    if(! MLPutSymbol(lp, "x", 1))
        { /* unable to put the symbol to lp */ }

    if(! MLEndPacket(lp))
        { /* unable to send the end-of-packet sequence to lp */ }

    if(! MLFlush(lp))
        { /* unable to flush any buffered output data in lp */ }
}
© 2008 Wolfram Research, Inc. japanese.gif
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team