Re: MathLink with Visual C++ 6.0
- To: mathgroup at smc.vnet.net
- Subject: [mg33563] Re: [mg33534] MathLink with Visual C++ 6.0
- From: "Lawrence A. Walker Jr." <lwalker701 at earthlink.net>
- Date: Sun, 31 Mar 2002 04:09:17 -0500 (EST)
- Organization: Morgan State University, COMSARE
- References: <200203291113.GAA07223@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi David,
Regarding your problems with generating your_filetm.c, you can try the
following ...
Select Project -> Settings...
Select your_file.tm in the panel on the left.
Select the Custom Build tab.
In the Commands section make sure you have something like ...
mprep your_file.tm -o your_filetm.c
In the Outputs section make sure you have something like ...
.\your_filetm.c
Hope this helps.
Below is the form of the main() function I always use -- I am not sure
if this is the latest.
Lawrence
*************************************************
#if MACINTOSH_MATHLINK
int main( int argc, char* argv[])
{
/* Due to a bug in some standard C libraries that have shipped with
* MPW, zero is passed to MLMain below. (If you build this program
* as an MPW tool, you can change the zero to argc.)
*/
argc = argc; /* suppress warning */
return MLMain( 0, argv);
}
#elif WINDOWS_MATHLINK
#if __BORLANDC__
#pragma argsused
#endif
int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious,
LPSTR lpszCmdLine, int nCmdShow)
{
char buff[512];
char FAR * buff_start = buff;
char FAR * argv[32];
char FAR * FAR * argv_end = argv + 32;
if( !MLInitializeIcon( hinstCurrent, nCmdShow)) return 1;
MLScanString( argv, &argv_end, &lpszCmdLine, &buff_start);
return MLMain( argv_end - argv, argv);
}
#else
int main(argc, argv)
int argc; char* argv[];
{
return MLMain(argc, argv);
}
#endif
*************************************************
David Park wrote:
>Dear MathGroup,
>
>I decided that I should learn some C++ and MathLink to extend what I can do
>with Mathematica. I have some C++ under my belt but am having trouble
>getting started with MathLink.
>
>Is there anyone with experience using Visual C++ 6.0 with MathLink who could
>give me a hand?
>
>I copied the required files into the VC98 folder and then tried to build the
>addtwo.exe example following the "Using the integrated development
>environment V6.0" instructions in the DeveloperGuide. It seemed to run the
>mprep program but did not actually create an addtwotm.c file and this caused
>a fatal error. Also, I need advice on a proper form for the main function,
>as the ones in the examples seem to be out of date.
>
>David Park
>djmp at earthlink.net
>http://home.earthlink.net/~djmp/
>
>
>
--
Lawrence A. Walker Jr.
http://www.kingshonor.com
- References:
- MathLink with Visual C++ 6.0
- From: "David Park" <djmp@earthlink.net>
- MathLink with Visual C++ 6.0