[ADMB Users] Broken tpl2cpp in Windows

Arni Magnusson arnima at hafro.is
Wed Apr 22 09:40:28 PDT 2009


I finally found the problem. The broken tpl2cpp in ADMB for MinGW gets 
created from the call:

   gcc -I. -DUX mylex.c -otpl2cpp

The -DUX should only be used when compiling mylex.c->tpl2cpp on Linux. In 
mylex.c, Dave Fournier defined a macro called UX that helps the compiler 
choose the right lines of code, depending on whether mylex.c is being 
compiled on Windows or Linux. By using -DUX it calls things appropriate 
for Linux, while bypassing the code intended for Windows. In other words, 
a healthy tpl2cpp for MinGW should be created with the call

   gcc -I. mylex.c -otpl2cpp

or better still

   gcc -s mylex.c -o tpl2cpp

for a leaner executable.

---

The problem lies in mingw.mak, which currently calls 
optg32-rh8-laplace.mak. As the name implies, the latter makefile is 
intended for Red Hat 8 Linux and is therefore not appropriate for making 
ADMB for Windows.

The solution is to edit mingw.mak so that it calls a makefile intended for 
making ADMB for Windows. This is a much better solution than making ADMB 
for Windows dependent on cat.exe. Dave Fournier already did the hard work 
creating the UX macro to make ADMB for Windows self-contained.

The same corrections need to be made for tpl2rem, which also uses Red Hat 
8 Linux makefiles. It looks like the Windows makefiles will be very 
similar, except no -DUX.

Quack,

Arni



More information about the Users mailing list