Re: No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000
- To: mathgroup at smc.vnet.net
- Subject: [mg31625] Re: [mg31600] No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Sun, 18 Nov 2001 06:29:11 -0500 (EST)
- Organization: "Wolfram Research, Inc."
- Sender: owner-wri-mathgroup at wolfram.com
On Fri, 16 Nov 2001, Matthew D. Langston wrote: > I'm trying to recompile, using gcc 2.95.3, a library of functions > written in C/C++ that I have already successfully exported to > Mathematica (using MathLink) with cl.exe version 6 (from Microsoft > Visual Studio 6.0) and cl.exe version 7 (from Microsoft Visual > Studio.NET). > > I'm running Windows 2000 SP2, Mathematica 4.1, and using mldev32 from > the MathLink Developer's Kit v3r9. The version of gcc I am using is > 2.95.3-5 from the Cygwin 1.3.5 release (which is the latest version as I > write this). > > I'm linking against the ml32i2m.lib import library (the version for > Microsoft Visual Studio 6.0). > > I'm passing "-mwindows" to gcc at both compile time and link time, and > passing "-e _mainCRTStartup" to gcc at link time. This *should* give me > an official, respectable Win32 application. And indeed, these options > do work in creating working Win32 applications. > > My library of C/C++ functions compiles and links fine with all three > compilers (i.e. gcc 2.95.3, cl.exe version 6, and cl.exe version 7). My > functions work just fine (after Install[]ing them in Mathematica ) using > the two Microsoft compilers, but the gcc version "appears" to hang > Mathematica. > > When I run Install["Minuitgcc`"] (to load the gcc version of my MathLink > exported functions) from within the Mathematica Front End, I get a > dialog box with the title "MathLink" that has a "Create link:" label, a > text entry box and an "OK" and "Cancel" button. > > If I click the "OK" button (without entering anything in the text box) > then I get another dialog box with the title "MathLink" that has a "Link > created on: 628" label and an "OK" button. > > My MathLink program appears in the Windows Task Manager as task > "Minuitgcc(628)" with a status of "Running". However, Mathematica just > hangs on the cell that executed the Install["Minuitgcc`"] command. The > title of the Front End Mathematica window is "Running...m2c.nb" (my > notebooks name is m2c.nb). > > The exact same code is being used by all three compilers (i.e. my source > code of functions, the same mathlink.h file, the same output file from > mprep, the same ml32i2m.lib import library, etc.). The only difference > is the compiler/linker. > > Why do the two Microsoft compilers create working MathLink programs, > while gcc doesn't? What happens if you try the following steps: 1) Launch the MathLink program Minuitgcc from the command line with the flag "-linkcreate": cd <path to Minuitgcc> .\Minuitgcc -linkcreate 2) Note the name of the link displayed by the resulting dialog box. 3) From a Mathematica kernel, invoke the following functions: lnk = LinkConnect[<name of the link from (2), written as a string>] Install[lnk] If this works, then the problem may have something to do with the execution environment of Cygwin itself. Install[] on a filename should be the equivalent of creating a link with LinkLaunch[] and then passing the resulting link to Install[]. -- P.J. Hinton User Interface Programmer paulh at wolfram.com Wolfram Research, Inc. Disclaimer: Opinions expressed herein are those of the author alone.