MathGroup Archive 2001

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

Search the Archive

Re: Using rules with MathLink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29261] Re: Using rules with MathLink
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 9 Jun 2001 03:08:49 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9fq226$qe1$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

general you can't.

The normal way is to write a Mathematica
function that evaluate the options and call
a raw C-function.

MyFunction[x_,opts___]:=
  Module[{prec},
     prec = Precision /. {opts} /. Options[MyFunction];
     If[!IntegerQ[prec], prec=16];
     rawCFunctionInYourMLProgram[N[x,prec],prec]
    ]

If you like the more complicated way, you can
declare the last argument of you C-function
as manual, and read the rules with MLGetFunction()...
and friends but than you need clever recursive
C-function that look for types, symbols ... 

The frist version is much easier.

Regards
  Jens

Mario Drobics wrote:
> 
> How can I use rule parameters like
> func[params, option->value]
> to set options within my MathLink C++ program
> (e.g. to set the precision of a numeric computation)?
> 
> -mario drobics-


  • Prev by Date: Re: Fourth degree polynomial
  • Next by Date: Re: Replacing 1 to many in a list
  • Previous by thread: Using rules with MathLink
  • Next by thread: Random Function in Mathematica