MathLink dynamic parameter in function
- To: mathgroup at smc.vnet.net
- Subject: [mg33852] MathLink dynamic parameter in function
- From: brehm at mse.eng.ohio-state.edu (Holger)
- Date: Sat, 20 Apr 2002 02:49:39 -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