1. Create a solution that will hold all the projects that we will create. To do this, go to File - New project - Visual C++ - Win32 Console Application. Provide the name for the solution e.g. QuantLibJava. This brings you to the Win32 Application Wizard. Here select Next - Select Console application - Empty project - Finish. This will create a solution named QuantLibJava that holds an empty project named QuantLibJava. Right click on this empty project and select Remove as we will not need this empty project. This will not delete the project file from the directory so you should navigate to the directory and delete the project file. 2. Now create the project that will create the base quantlib.lib file that we will link into our .dll file. In the Solution Explorer pane, right-click on 'Solution QuantLibJava' and select Add - New Project - Visual C++ - Win32 Console Application. Provide a name for the project, quantlib say. You are then brought to the Win32 Application Wizard. Here select Next - Console application - Static library - Finish (make sure that precompiled headers is unchecked). This creates the project quantlib in the solution QuantLibJava. Remove all the default filters and files from this project. Add all the files from \quantlib\QuantLib\ql to the project and compile to produce the static library quantlib.lib. 3. Now, add the project that will create the DLL and JAR. In the Solution Explorer pane, right-click on 'Solution QuantLibJava' and Add - New Project - Visual C++ - Win32 Console Application. Provide a name for the project e.g. quantlib_wrap. You are then brought to the Win32 Application Wizard. Here select Next - Console application - DLL - Finish (make sure that precompiled headers is unchecked). Remove all default filters and files from the project. 4. Now add a C++ file to the project created in step 3. This file will hold the intermediate C++ code that swig will generate in step 5. Right-click on project Add - New Item - C++ File. Assume that we name this file quantlib_wrap.cpp. 5. Now add the SWIG interface files to the project created in step 3 and set up a custom build step that will run the swig command on these files. Right-click on the project and add a filter, SWIG say. Right click on filter SWIG - Add - Existing Item. Navigate to where you have saved your SWIG interface files (\swig\SWIG in my case) and add all these files, i.e., the .i files that QuantLib provides and any that you have written yourself. Select 'No' when you are asked if you wish to add a custom build rule. We will add this now manually. First create a folder \swig\Java\org\quantlib to hold the Java files that swig will generate. Right-click on quantlib.i and select Properties - Custom Build Step and add the following to the Command line field: \swig -java -c++ -outdir \swig\Java\org\quantlib -package org.quantlib -o quantlib_wrap.cpp $(InputPath). $(OutDir)\quantlib.dll ------------ Put a description in the description field, e.g., -- SWIG Step --. This will be output to the console during the build. In Outputs put the name of the .cpp file created in step 4, i.e., quantlib_wrap.cpp. Now select all other .i files in the SWIG filter, i.e., all those except quantlib.i, right-click and select Properties. Add the same as above to the custom build rule section except do not place anything in the Outputs field. 6. In this step, add general settings to the project quantlib_wrap. Right-click on the project and go to Properties - Configuration Properties - C/C++ - General - Additional Include Directories. Add the paths to the JNI header files. The paths look something like C:\ProgramFiles\Java\jdk1.6.0_24\include and C:\ProgramFiles\Java\jdk1.6.0_24\include\win32. To give the resulting DLL a name, right-click on the project and go to Properties - Configuration Properties - Linker - General - Output File and add a name e.g. $(OutDir)\QuantLib.dll. Note: In \quantlib\QuantLib\ql, there is a file named auto_link.hpp that leads to your visual studio project automatically trying to link to specified libraries depending on the configuration that you are using. Rather than changing this file, you can set the \NODEFAULTLIB option to ignore the request to link to these libraries. In particular, right-click on the project and go to Properties - Configuration Properties - Linker - Input and in the Ignore Specific Library field, give the names of the libraries that you wish to ignore. Finally, you must tell your project to link to the static library quantlib.lib that you created in step 2. To do this, right-click on the project and go to Properties - Configuration Properties - Linker - General and add the path to this library to the Additional Library Directories field. Also, right-click on the project and go to Properties - Configuration Properties - Linker - Input and add the library names to the Additional Dependencies field. 7. The last step is to add the Java related commands as a post-build event. Firstly, create a directory \swig\Java\bin to hold the Java files that will be generated. Right-click on the project and go to Properties - Configuration Properties - Build Events Post-Build Event. Enter the following in the Command line field: "\Java\jdk1.6.0_24\bin\javac" \swig\Java\org\quantlib\*.java -d \swig\Java\bin" "\Java\jdk1.6.0_24\bin\jar" cf quantlib.jar -C \swig\Java\bin . -C \swig\Java\org .