MathGroup Archive 2002

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

Search the Archive

MathLink dynamic parameter to C++?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33869] MathLink dynamic parameter to C++?
  • From: brehm.33 at osu.edu (Holger Coldsprings)
  • Date: Sun, 21 Apr 2002 06:12:14 -0400 (EDT)
  • Organization: Ohio State University
  • Sender: owner-wri-mathgroup at wolfram.com

What I've done so far:
I use MathLink to generate and manipulate arrays within C++ and return
them to Mathematica in order to speed it up. To achieve that I define
a function with several parameters within C++ and call this function
from within Mathematica. That works just fine.

What I intend to do:
When I call a function from Mathematica I would like to hand over one
parameter (beside others) which is to be used as the length of the
list later on in C++ (dynamic variable).

What my problem is:

I cannot hand over a parameter value from Mathematica to C++ and use
it as the length of the list, but always have to use a fixed value.
When I try to make this variable dynamical like this:

double **stressstrainarray; // array gener. in C, not from Mathematica
stressstrainarray = new double* [time]; //time param. from Mathematica
        for(i=0;i<time;i++)
        {
                stressstrainarray[i] = new double [2];
        }

(here "time" is intended to be the length of the list and a parameter
handed over from Mathematica) I get an error message like:
" 'new': undeclared identifier " which I find very weird because the
code given above works just fine for a stand alone code in C++. Any
help is very kindly appreciated. Thanks,

                                Holger


  • Prev by Date: Re: How Do You Reduce Multiple Elements in a List?
  • Next by Date: Re: Using NonlinearFit/Regress?
  • Previous by thread: Re: Explicit Conjugate: a feature or a bug?
  • Next by thread: Question about Removed[]