Bill Daly on Wed, 30 Jun 1999 14:28:01 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Compiling PARI with MSVC


Here is a description of the steps necessary to compile PARI with the
MSVC
compiler under WIN32.

1. Unzip the archive, preserving folder names so that the directory
structure
is correct. I use WinZip to do this, and I put the files on my D: drive,
so
that the files for pari.2.0.16.beta for example will be stored under
D:\pari.2.0.16.beta. Note that the archive as downloaded, pari.tgz, is
an
archive of an archive. Winzip doesn't know how to unzip pari.tgz, so I
use
Aladdin Expander to do this, which will create for example the file
pari.2.0.16.beta.tar in the same directory as pari.tgz. Unfortunately,
Aladdin Expander doesn't know how to unzip this file, so I use Winzip to
do it. Isn't Windows wonderful?

2. MSVC doesn't like names of the form "pari.2.0.16.beta", so rename the
base
directory to something like "pari216b". Now the files are stored under
D:\pari216b.

3. Start MSVC (I use version 6, but earlier versions will probably work
the
same way).

4. Select "File\New..." and pick the "Project" tab to create a new
project.
Select "Win32 Console Application" as the project type, and specify the
project
name as "pari216b". Make sure that the "Location" of the files is
D:\pari216b.
Click "OK", then select "An empty project" (should be the default
anyway) and
click "Finish".

5. Select "Project\Add to project\Files..." to add files to the project.
Select
all the *.c and *.h files in src\basemath, src\headers, src\kernel\ix86,
src\language, src\modules and win32; all of the files in src\gp except
gp_rl.c;
the files plotnull.c, plotport.c and rect.h in src\graph.c; and the file
src\kernel\none\mp.c.

6. Select "Project\Settings" and pick the "C/C++" tab. Select
"Preprocessor"
from the "Category" menu, and enter
"D:\pari216b\src\headers,D:\pari216b\win32"
into the "Additional include directories" box. (I also select the "Code
Generation" category and change the "Struct member alignment" to "1
byte",
but this may not be necessary.) It is usually convenient for debugging
to
select the "Debug" tab and specify a "Working directory", e.g. "D:\gp"
if
you have .gp files there that you can use for testing.

You should now be able to build and test the program. When you want to
build
a release version, you will have to repeat step 6 above, since MSVC
doesn't
apply the project settings globally.

A couple of points:

You may get some inconsequential warning messages. You can suppress
these
by adding a line of the form:

   #pragma warning(disable: ...)

to paricfg.h, where ... is a space-delimited list of warning numbers,
e.g.
"4018 4244" corresponding to the warnings C4018 and C4244.

When you compile a release version, global optimization is enabled by
default.
MSVC is fairly buggy with global optimization, so you may find that some
modules won't compile with it, e.g. sumiter.c. You can either disable
global
optimization (in "Project\Settings" under the tab "C/C++" in the
category
"Optimization"), or you can surround the offending code with:

   #pragma optimization("g", off)
   ...
   #pragma optimization("g", on)


Regards,

Bill
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************