MathGroup Archive 2002

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

Search the Archive

Re: MathLink with Visual C++ 6.0

  • To: mathgroup at
  • Subject: [mg33563] Re: [mg33534] MathLink with Visual C++ 6.0
  • From: "Lawrence A. Walker Jr." <lwalker701 at>
  • Date: Sun, 31 Mar 2002 04:09:17 -0500 (EST)
  • Organization: Morgan State University, COMSARE
  • References: <>
  • Sender: owner-wri-mathgroup at

Hi David,

Regarding your problems with generating your_filetm.c, you can try the 
following ...

    Select Project -> Settings...
    Select in the panel on the left.
    Select the Custom Build tab.

    In the Commands section make sure you have something like ...
    mprep -o your_filetm.c

    In the Outputs section make sure you have something like ...

Hope this helps.

Below is the form of the main() function I always use -- I am not sure 
if this is the latest.




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);


#if __BORLANDC__
#pragma argsused

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);


int main(argc, argv)
    int argc; char* argv[];
    return MLMain(argc, argv);



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

Lawrence A. Walker Jr.

  • Prev by Date: RE: common factors in a matrix
  • Previous by thread: MathLink with Visual C++ 6.0
  • Next by thread: Mathematica problem