143 lines
5.5 KiB
Plaintext
143 lines
5.5 KiB
Plaintext
|
|
To create MIRACL applications under Microsoft Windows using Microsoft C++
|
|
version 6.0, follow these steps. Remember a "Release" build will be
|
|
faster than a "Debug" build. For MS VC++ .NET see below.
|
|
|
|
|
|
First build the library from the command line, using one of the supplied
|
|
batch files, like ms32doit.bat, or ms64doit.bat for a 64-bit build.
|
|
|
|
1. Create a new empty project of type "Win32 Console Application"
|
|
Give it the name of the associated main project file, e.g. limlee
|
|
for limlee.cpp
|
|
|
|
2. Click on "Project", and then on "Add to Project", and then on "Files"
|
|
|
|
3. Select "library files (.lib)" from the "Files of type" drop-down list.
|
|
Look for the precompiled MIRACL library file miracl.lib, and insert it
|
|
into the project.
|
|
|
|
4. Add the main project file (e.g.limlee.cpp) into the project.
|
|
|
|
5. Only if it is a C++ main project file, also add into the project any
|
|
other needed files, like big.cpp/zzn.cpp etc. Those required are
|
|
specified in the comments at the start of the main project file, e.g.
|
|
* Requires: big.cpp zzn.cpp
|
|
This step is not required for C projects.
|
|
|
|
6. Now click on "Project" and then on "Settings". Click the C/C++ tab and
|
|
select the "preprocessor" category. Find the box "Additional Include
|
|
Directories", and specify a path to the miracl header files,
|
|
mirdef.h/miracl.h/big.h etc..
|
|
|
|
7. Make sure that any files needed by the application are available in the
|
|
directory from which the application is run. For example *.key *.dss,
|
|
or *.ecs files
|
|
|
|
8. Now build and run the project.
|
|
|
|
|
|
|
|
To create a new version of the MIRACL library using Visual Studio,
|
|
|
|
1. Compile and run the config.c utility, and rename the generated mirdef.tst
|
|
to mirdef.h
|
|
Note that Microsoft C has a 64-bit integer data type called "__int64"
|
|
(although with newer versions of the compiler now its OK to refer to it
|
|
as "long long")
|
|
|
|
2. Create a new project of type "Win32 Static Library". Then click on "Finish".
|
|
|
|
3. Add in the appropriate files mr*.c. The ones required are those listed in
|
|
miracl.lst (also generated by the config utility).
|
|
|
|
4. Now click on "Project" and then on "Settings". Click the C/C++ tab and
|
|
select the "preprocessor" category. Find the box "Additional Include
|
|
Directories", and specify a path to the miracl header files
|
|
mirdef.h and miracl.h
|
|
|
|
5. Now build the project and create the MIRACL library.
|
|
|
|
|
|
--------------------------------------------------------------------------------------------
|
|
|
|
|
|
To create MIRACL applications under Microsoft Windows using Microsoft C++
|
|
.NET, follow these steps.
|
|
|
|
1. Click on New and Project, and select "Visual C++ Projects", "Win32",
|
|
select "Win32 Console Project", and give the project name, for example
|
|
limlee, for the limlee.cpp example. Click on Finish.
|
|
|
|
2. Now things get a little tricky. An empty limlee.cpp file is provided.
|
|
You must now cut and paste from the Miracl provided file limlee.cpp into
|
|
this one. Note that the main program is now called _tmain.
|
|
|
|
3. Click on Project, and on "Add existing Item", and Select "All files" from
|
|
the "Files of type" drop-down list.
|
|
Look for the precompiled MIRACL library file miracl.lib, and insert it
|
|
into the project.
|
|
|
|
4. Only if it is a C++ main project file, also add into the project any
|
|
other needed files, like big.cpp/zzn.cpp etc. Those required are
|
|
specified in the comments at the start of the main project file, e.g.
|
|
* Requires: big.cpp zzn.cpp
|
|
This step is not required for C projects. Use "Project", and "Add existing
|
|
Item".
|
|
|
|
5. Click on Project and then "Properties". Open up the C++ Tab, go to "Precompiled
|
|
Headers", and select "Not using precompiled headers" from the drop-down box.
|
|
Open the "General" Tab, and specify a path to the miracl header files, mirdef.h,
|
|
miracl.h and big.h etc.
|
|
|
|
6. Build the project and run it by clicking "Debug" and "Start". The program runs
|
|
to completion and exits.
|
|
|
|
|
|
|
|
To create a new version of the MIRACL library, first create a suitable
|
|
mirdef.h as above, then
|
|
|
|
1. Click on New and Project, and select "Visual C++ Projects", "Win32",
|
|
enter the name Miracl and click on "Win32 Project" and then OK.
|
|
|
|
2. Click on "Application Settings", and then select "Static Library".
|
|
Then click on Finish
|
|
|
|
3. Add in the appropriate files mr*.c. (Project followed by "Add Existing Items").
|
|
|
|
4. Click on Project and then "Properties". Open up the C++ Tab, go to "Precompiled
|
|
Headers", and select "Not using precompiled headers" from the drop-down box.
|
|
Open the "General" Tab, and specify a path to the miracl header files, mirdef.h
|
|
and miracl.h
|
|
|
|
5. Now build the project.
|
|
|
|
|
|
--------------------------------------------------------------------------------------
|
|
|
|
|
|
If using MIRACL within an MFC based Win32 project, here are some hints.
|
|
|
|
1. Build a MIRACL library with MR_NO_STANDARD_IO defined in mirdef.h
|
|
The config.c utility can be used as usual to create a suitable mirdef.h
|
|
|
|
2. If using the C++ MIRACL classes, don't forget to change the default project
|
|
settings for the MIRACL implementation files such as big.cpp to "not using
|
|
pre-compiled headers".
|
|
|
|
3. Don't forget that MIRACL is a C library, not C++. To call MIRACL routines
|
|
directly from a C++ program you must:-
|
|
|
|
extern "C"
|
|
{
|
|
#include "miracl.h"
|
|
}
|
|
|
|
If using C++, its probably preferable to access MIRACL via the C++ wrapper
|
|
classes such as implemented by big.h/big.cpp. See big.h file for more tips.
|
|
|
|
4. To display a big number, convert it first to a string. See the comments at
|
|
the start of big.h
|
|
|