From 0c4648435b95f73dbad1e60e2ea701870b0534d3 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Fri, 19 Dec 2008 10:29:52 +0000 Subject: [PATCH] Added EXPORTs to fix DLL issues on Windows. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@900 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/include/dv.h | 4 ++-- prism/include/sparse.h | 31 +++++++++++++++++++------------ prism/src/sparse/sparse.cc | 24 ++++++++++++------------ 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/prism/include/dv.h b/prism/include/dv.h index 564eb0e2..661e132c 100644 --- a/prism/include/dv.h +++ b/prism/include/dv.h @@ -58,8 +58,8 @@ struct DistVector int num_dist; unsigned short *ptrs; - DistVector(); - ~DistVector(); + EXPORT DistVector(); + EXPORT ~DistVector(); }; // function prototypes diff --git a/prism/include/sparse.h b/prism/include/sparse.h index f8cf462e..7f8bcbe0 100644 --- a/prism/include/sparse.h +++ b/prism/include/sparse.h @@ -28,6 +28,13 @@ #include #include +// Flags for building Windows DLLs +#ifdef __MINGW32__ + #define EXPORT __declspec(dllexport) +#else + #define EXPORT +#endif + // data structures // "row major" sparse matrix @@ -45,8 +52,8 @@ struct RMSparseMatrix unsigned int *cols; unsigned char *row_counts; - RMSparseMatrix(); - ~RMSparseMatrix(); + EXPORT RMSparseMatrix(); + EXPORT ~RMSparseMatrix(); }; // "column major" sparse matrix @@ -64,8 +71,8 @@ struct CMSparseMatrix unsigned int *rows; unsigned char *col_counts; - CMSparseMatrix(); - ~CMSparseMatrix(); + EXPORT CMSparseMatrix(); + EXPORT ~CMSparseMatrix(); }; // "row/column" sparse matrix @@ -83,8 +90,8 @@ struct RCSparseMatrix unsigned int *rows; unsigned int *cols; - RCSparseMatrix(); - ~RCSparseMatrix(); + EXPORT RCSparseMatrix(); + EXPORT ~RCSparseMatrix(); }; // "compact modified sparse row" sparse matrix @@ -106,8 +113,8 @@ struct CMSRSparseMatrix unsigned int *cols; unsigned char *row_counts; - CMSRSparseMatrix(); - ~CMSRSparseMatrix(); + EXPORT CMSRSparseMatrix(); + EXPORT ~CMSRSparseMatrix(); }; // "compact modified sparse column" sparse matrix @@ -129,8 +136,8 @@ struct CMSCSparseMatrix unsigned int *rows; unsigned char *col_counts; - CMSCSparseMatrix(); - ~CMSCSparseMatrix(); + EXPORT CMSCSparseMatrix(); + EXPORT ~CMSCSparseMatrix(); }; // nondeterministic (mdp) sparse matrix @@ -152,8 +159,8 @@ struct NDSparseMatrix unsigned char *row_counts; unsigned char *choice_counts; - NDSparseMatrix(); - ~NDSparseMatrix(); + EXPORT NDSparseMatrix(); + EXPORT ~NDSparseMatrix(); }; // function prototypes diff --git a/prism/src/sparse/sparse.cc b/prism/src/sparse/sparse.cc index c15de927..d147563d 100644 --- a/prism/src/sparse/sparse.cc +++ b/prism/src/sparse/sparse.cc @@ -54,7 +54,7 @@ static NDSparseMatrix *ndsm; // Data structure constructors/deconstructors //------------------------------------------------------------------------------ -RMSparseMatrix::RMSparseMatrix() +EXPORT RMSparseMatrix::RMSparseMatrix() { n = 0; nnz = 0; @@ -65,7 +65,7 @@ RMSparseMatrix::RMSparseMatrix() row_counts = NULL; } -RMSparseMatrix::~RMSparseMatrix() +EXPORT RMSparseMatrix::~RMSparseMatrix() { if (non_zeros) delete[] non_zeros; if (cols) delete[] cols; @@ -74,7 +74,7 @@ RMSparseMatrix::~RMSparseMatrix() //------------------------------------------------------------------------------ -CMSparseMatrix::CMSparseMatrix() +EXPORT CMSparseMatrix::CMSparseMatrix() { n = 0; nnz = 0; @@ -85,7 +85,7 @@ CMSparseMatrix::CMSparseMatrix() col_counts = NULL; } -CMSparseMatrix::~CMSparseMatrix() +EXPORT CMSparseMatrix::~CMSparseMatrix() { if (non_zeros) delete[] non_zeros; if (rows) delete[] rows; @@ -94,7 +94,7 @@ CMSparseMatrix::~CMSparseMatrix() //------------------------------------------------------------------------------ -RCSparseMatrix::RCSparseMatrix() +EXPORT RCSparseMatrix::RCSparseMatrix() { n = 0; nnz = 0; @@ -105,7 +105,7 @@ RCSparseMatrix::RCSparseMatrix() cols = NULL; } -RCSparseMatrix::~RCSparseMatrix() +EXPORT RCSparseMatrix::~RCSparseMatrix() { if (non_zeros) delete[] non_zeros; if (rows) delete[] rows; @@ -114,7 +114,7 @@ RCSparseMatrix::~RCSparseMatrix() //------------------------------------------------------------------------------ -CMSRSparseMatrix::CMSRSparseMatrix() +EXPORT CMSRSparseMatrix::CMSRSparseMatrix() { n = 0; nnz = 0; @@ -128,7 +128,7 @@ CMSRSparseMatrix::CMSRSparseMatrix() row_counts = NULL; } -CMSRSparseMatrix::~CMSRSparseMatrix() +EXPORT CMSRSparseMatrix::~CMSRSparseMatrix() { if (dist) delete[] dist; if (cols) delete[] cols; @@ -137,7 +137,7 @@ CMSRSparseMatrix::~CMSRSparseMatrix() //------------------------------------------------------------------------------ -CMSCSparseMatrix::CMSCSparseMatrix() +EXPORT CMSCSparseMatrix::CMSCSparseMatrix() { n = 0; nnz = 0; @@ -151,7 +151,7 @@ CMSCSparseMatrix::CMSCSparseMatrix() col_counts = NULL; } -CMSCSparseMatrix::~CMSCSparseMatrix() +EXPORT CMSCSparseMatrix::~CMSCSparseMatrix() { if (dist) delete[] dist; if (rows) delete[] rows; @@ -160,7 +160,7 @@ CMSCSparseMatrix::~CMSCSparseMatrix() //------------------------------------------------------------------------------ -NDSparseMatrix::NDSparseMatrix() +EXPORT NDSparseMatrix::NDSparseMatrix() { n = 0; nc = 0; @@ -174,7 +174,7 @@ NDSparseMatrix::NDSparseMatrix() choice_counts = NULL; } -NDSparseMatrix::~NDSparseMatrix() +EXPORT NDSparseMatrix::~NDSparseMatrix() { if (non_zeros) delete[] non_zeros; if (cols) delete[] cols;