Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Getting an array into a C program through mathlink
Replies: 2   Last Post: Apr 2, 2013 3:26 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Brentt

Posts: 60
Registered: 9/24/11
Getting an array into a C program through mathlink
Posted: Mar 14, 2013 7:12 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.