Re: No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000 SP2
- To: mathgroup at smc.vnet.net
- Subject: [mg31621] Re: [mg31600] No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000 SP2
- From: John Fultz <jfultz at wolfram.com>
- Date: Sun, 18 Nov 2001 06:29:04 -0500 (EST)
- References: <200111161138.GAA07033@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Fri, 16 Nov 2001 06:38:04 -0500 (EST), 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? > >Thank you for your help. > >Regards, Matt > >-- >Matthew D. Langston >SLD, Stanford Linear Accelerator Center >langston at SLAC.Stanford.EDU > > It sounds to me like the gcc version of your program isn't passing the command-line arguments to MLMain() correctly. If I had to guess, I'd say that gcc is using the main() startup function instead of WinMain(), and you didn't write your main() function to correctly pass argc and argv into MLMain(). Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc.
- References:
- No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000 SP2
- From: "Matthew D. Langston" <langston@SLAC.Stanford.EDU>
- No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000 SP2