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-