MathLink with C++
- To: mathgroup at smc.vnet.net
- Subject: [mg40694] MathLink with C++
- From: "Steve Luttrell" <luttrell at _removemefirst_westmal.demon.co.uk>
- Date: Mon, 14 Apr 2003 04:00:37 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I use Mathematica 4.2.1 for MS Windows. I need a simple example (like the "addtwo" MathLink example) to demonstrate precisely how one connects MathLink to classes in C++ (to drive C++ from Mathematica), but I can't find any information on this in the usual places. I use MS Visual C++ 6 and can get the "addtwo" example working, but I have not been successful in extending this example to use classes. At the Mathematica end of the link I would expect to do the following sort of thing (trivial example, but enough to get me started): obj = CreateObject[]; val = <number>; SetObjectValue[obj, val]; val2 = GetObjectValue[obj]; Print[val2]; DestroyObject[obj]; What would I have to put at the C++ end of the link (e.g. code to add to the "addtwo" example, say) to make the above "Object" class work for me? -- Steve Luttrell West Malvern, UK