A note on MathLink: cygwin Makefile for building addtwo.exe
- To: mathgroup at smc.vnet.net
- Subject: [mg78395] A note on MathLink: cygwin Makefile for building addtwo.exe
- From: "Rolf.Mertig at gmail.com" <Rolf.Mertig at gmail.com>
- Date: Sat, 30 Jun 2007 06:06:42 -0400 (EDT)
Somehow I could not get the instructions for "Building MathLink programs with Microsoft Visual Studio" http://reference.wolfram.com/mathematica/tutorial/MathLinkDeveloperGuide-Windows.html (i.e., steps 39. up to 66.) to work. Did anybody do this successfully? With or without VS-service packs? -- Instead I played with cygwin, and just a GNU "make" of the Makefile below will nicely build addtwo.exe on Windows XP. This works similar for C++ projects. Rolf # Makefile for addtwo using cygwin # # Rolf Mertig, GluonVision GmbH, http://www.gluonvision.com # # run from a Cygwin bash shell, or an xterm: make # # Assumes installation of cygwin (http://cygwin.com) # # the important linker flag ( in order to suppress the DOS window) is -mwindows, # see: http://www.wxwidgets.org/wiki/index.php/Cygwin # change this to your Mathematica 6 installation MLINKDIR=/cygdrive/c/Programme/Wolfram\ Research/Mathematica/6.0/SystemFiles/Links/MathLink/DeveloperKit RM = rm BINARIES = addtwo.exe # Set this value with the result of evaluating $SystemID SYS=Windows # since we use the -mno-cygwin option we can use mldev32 instead of cygwin CADDSDIR = ${MLINKDIR}/${SYS}/CompilerAdditions/mldev32 INCDIR = ${CADDSDIR}/include LIBDIR = ${CADDSDIR}/lib EXTRALIBS = -mwindows # see also: http://www.cygwin.com/faq/faq_3.html MLLIB = ML32i3m # Set this to ML64i3 if using a 64-bit system MPREP=${CADDSDIR}/bin/mprep all : addtwo addtwo : addtwotm.o addtwo.o ${CC} -I${INCDIR} addtwotm.o addtwo.o -L${LIBDIR} -l${MLLIB} ${EXTRALIBS} -o $@ .c.o : ${CC} -c -mno-cygwin -mwin32 -I${INCDIR} $< addtwotm.c : addtwo.tm ${MPREP} $? -o $@ clean : @ ${RM} -f addtwotm.c *.o ${BINARIES}