Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13835

Getting an array into a C program through mathlink

From Brentt <brenttnewman@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Getting an array into a C program through mathlink
Date 2013-03-14 11:12 +0000
Message-ID <khsbap$35l$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Hello, I've been wrestling with this example code from the manual to try to
get a numerical array to a C program through mathlink. But how does one set
up the template file for this kind of program (e.g. setting up a pattern to
actually call the program in Mathematica)? I tried to guess how to write a
template for this code, but nothing seemed to work (primarily errors about
incompatible types).

void f(MLINK lp)
> {
>     double *data;
>     int *dims;
>     char **heads;
>     int d; /* stores the rank of the array */
>
>     if(! MLGetReal64Array(lp, &data, &dims, &heads, &d))
>         {
>             /* unable to read the array from lp */
>             return;
>         }
>
>     /* ... */
>
>     MLReleaseReal64Array(lp, data, dims, heads, d);
> }
>

 I've got some functions using simple data types working using Mathlink,
and I even go the MLPut*Array type functions working. It's just getting an
array from mathematica in to an external (C) program that I haven't found
much detailed information in the manual about. A lot of examples like these
that aren't really functional as is.

Thank you in advance

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Getting an array into a C program through mathlink Brentt <brenttnewman@gmail.com> - 2013-03-14 11:12 +0000
  Re: Getting an array into a C program through mathlink debguy <johnandsara2@cox.net> - 2013-04-01 04:57 +0000
  Re: Getting an array into a C program through mathlink John Fultz <jfultz@wolfram.com> - 2013-04-02 07:26 +0000
  Re: Getting an array into a C program through mathlink "John D. Hendrickson and Sara Darnell" <johnandsara2@cox.net> - 2013-04-03 08:08 +0000
  Re: Getting an array into a C program through mathlink John Fultz <jfultz@wolfram.com> - 2013-04-04 02:50 +0000
  Re: Getting an array into a C program through mathlink "John D. Hendrickson and Sara Darnell" <johnandsara2@cox.net> - 2013-04-04 17:10 +0000

csiph-web