Wednesday, January 27, 2010

How to port CUDD to Windows and use CUDD as a library

This file provides instruction on the installation of the Windows port of the CU Decision Diagram Package CUDD v.2.4.2
(0) Dowload the CUDD v. 2.3.1 source code release: ftp://vlsi.colorado.edu/pub/cudd-2.3.1.tar.gz

(1) Create an empty project of type Win32->Win32 Project->Dll
(2) Copy the the code of CUDD v. 2.3.1 into the project folder and include CUDD package to the project
(3) Change file name "cuddObj.cc" to "cuddObj.cpp" change file name "cuddObj.hh" to "cuddObj.h"
(4) Add the code the project workspace using Project -> AddToProject -> Files Do not add the files with test programs (they do not belong to the library): "cudd/testcudd.c", "dddmp/testdddmp.c", "mtr/testmtr.c", "util/test-res.c", "util/test-sav.c". Do not include file "util/pipefork.c" because it contains UNIX-specific commandsAlso do not include all test file for each module
Do not add the files "nanotrav/*.c" to the project, because "nanotrav" is a stand-alone application which should not be part of the static library.
(5) Add "include" to Project -> Settings -> C/C++ -> Additional include directories in both debug and release versions.
(6) Define "__STDC__" in Project -> Settings -> C/C++ -> Preprocessor definitions in both debug and release versions.
(7) In "util.h": comment out two lines:
#include <unistd.h> (there is no such file on Windows)
#include <ctype.h> (this #include is the reason of mysterious malfunctions in some projects)
(8) Exclude the mnemosyne in cudd (This is a set of tools designed to help find memory leaks in programs, and to locate memory-hogging functions)
(9) In "datalimit.c": comment out #include <sys/resource.h> and change #include <sys/time.h> to #include <time.h>
(10)In "cuddObj.cpp": add the following definitions
#define long(a) (long)(a)
#define hex(a) hex<<(a)
to fix the problem with outputting the hexadecimal numbers
(11) Exclude sis from project
(12) Adapt #include "cuddObj.hh" to #include "cuddObj.h" for each error
(13) Exclude 2 files in dddmp: dddmpDdNodeBdd.c and dddmpDdNodeCnf.c
(14) Put this line to cudd.h
#define DllExport __declspec( dllexport )
since then put DllExport constant before each interface in the cudd.h

Now you can build a C++ library of CUDD package.