diff --git a/IPhreeqc.sln b/IPhreeqc.sln index 41bd2df5..f3276e8b 100644 --- a/IPhreeqc.sln +++ b/IPhreeqc.sln @@ -33,52 +33,82 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + DebugDll|Win32 = DebugDll|Win32 MemDebug|Win32 = MemDebug|Win32 Release|Win32 = Release|Win32 + ReleaseDll|Win32 = ReleaseDll|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Debug|Win32.ActiveCfg = Debug|Win32 {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Debug|Win32.Build.0 = Debug|Win32 + {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.DebugDll|Win32.ActiveCfg = DebugDll|Win32 + {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.DebugDll|Win32.Build.0 = DebugDll|Win32 {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.MemDebug|Win32.ActiveCfg = MemDebug|Win32 {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.MemDebug|Win32.Build.0 = MemDebug|Win32 {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Release|Win32.ActiveCfg = Release|Win32 {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.Release|Win32.Build.0 = Release|Win32 + {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32 + {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32 {270BB952-FCB2-4FA8-821E-BB750E83C902}.Debug|Win32.ActiveCfg = Debug|Win32 {270BB952-FCB2-4FA8-821E-BB750E83C902}.Debug|Win32.Build.0 = Debug|Win32 + {270BB952-FCB2-4FA8-821E-BB750E83C902}.DebugDll|Win32.ActiveCfg = Release|Win32 + {270BB952-FCB2-4FA8-821E-BB750E83C902}.DebugDll|Win32.Build.0 = Release|Win32 {270BB952-FCB2-4FA8-821E-BB750E83C902}.MemDebug|Win32.ActiveCfg = MemDebug|Win32 {270BB952-FCB2-4FA8-821E-BB750E83C902}.MemDebug|Win32.Build.0 = MemDebug|Win32 {270BB952-FCB2-4FA8-821E-BB750E83C902}.Release|Win32.ActiveCfg = Release|Win32 {270BB952-FCB2-4FA8-821E-BB750E83C902}.Release|Win32.Build.0 = Release|Win32 + {270BB952-FCB2-4FA8-821E-BB750E83C902}.ReleaseDll|Win32.ActiveCfg = Release|Win32 + {270BB952-FCB2-4FA8-821E-BB750E83C902}.ReleaseDll|Win32.Build.0 = Release|Win32 {14BB3A4C-1ADE-4212-8931-6514BF913874}.Debug|Win32.ActiveCfg = Debug|Win32 {14BB3A4C-1ADE-4212-8931-6514BF913874}.Debug|Win32.Build.0 = Debug|Win32 + {14BB3A4C-1ADE-4212-8931-6514BF913874}.DebugDll|Win32.ActiveCfg = DebugDll|Win32 + {14BB3A4C-1ADE-4212-8931-6514BF913874}.DebugDll|Win32.Build.0 = DebugDll|Win32 {14BB3A4C-1ADE-4212-8931-6514BF913874}.MemDebug|Win32.ActiveCfg = MemDebug|Win32 {14BB3A4C-1ADE-4212-8931-6514BF913874}.MemDebug|Win32.Build.0 = MemDebug|Win32 {14BB3A4C-1ADE-4212-8931-6514BF913874}.Release|Win32.ActiveCfg = Release|Win32 {14BB3A4C-1ADE-4212-8931-6514BF913874}.Release|Win32.Build.0 = Release|Win32 + {14BB3A4C-1ADE-4212-8931-6514BF913874}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32 + {14BB3A4C-1ADE-4212-8931-6514BF913874}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32 {0BF09B12-56BE-42FC-B39E-61AE515D8858}.Debug|Win32.ActiveCfg = Debug|Win32 {0BF09B12-56BE-42FC-B39E-61AE515D8858}.Debug|Win32.Build.0 = Debug|Win32 + {0BF09B12-56BE-42FC-B39E-61AE515D8858}.DebugDll|Win32.ActiveCfg = DebugDll|Win32 + {0BF09B12-56BE-42FC-B39E-61AE515D8858}.DebugDll|Win32.Build.0 = DebugDll|Win32 {0BF09B12-56BE-42FC-B39E-61AE515D8858}.MemDebug|Win32.ActiveCfg = MemDebug|Win32 {0BF09B12-56BE-42FC-B39E-61AE515D8858}.MemDebug|Win32.Build.0 = MemDebug|Win32 {0BF09B12-56BE-42FC-B39E-61AE515D8858}.Release|Win32.ActiveCfg = Release|Win32 {0BF09B12-56BE-42FC-B39E-61AE515D8858}.Release|Win32.Build.0 = Release|Win32 + {0BF09B12-56BE-42FC-B39E-61AE515D8858}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32 + {0BF09B12-56BE-42FC-B39E-61AE515D8858}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32 {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.Debug|Win32.ActiveCfg = Debug|Win32 {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.Debug|Win32.Build.0 = Debug|Win32 + {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.DebugDll|Win32.ActiveCfg = DebugDll|Win32 + {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.DebugDll|Win32.Build.0 = DebugDll|Win32 {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.MemDebug|Win32.ActiveCfg = Debug|Win32 {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.MemDebug|Win32.Build.0 = Debug|Win32 {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.Release|Win32.ActiveCfg = Release|Win32 {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.Release|Win32.Build.0 = Release|Win32 + {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32 + {29C3C862-28CA-4BF2-BAF5-A8F8ABF15C12}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.Debug|Win32.ActiveCfg = Debug|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.Debug|Win32.Build.0 = Debug|Win32 + {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.DebugDll|Win32.ActiveCfg = DebugDll|Win32 + {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.DebugDll|Win32.Build.0 = DebugDll|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.MemDebug|Win32.ActiveCfg = Debug|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.MemDebug|Win32.Build.0 = Debug|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.Release|Win32.ActiveCfg = Release|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.Release|Win32.Build.0 = Release|Win32 + {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32 + {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32 {046110C9-CD5B-404D-B197-E295656CBF7F}.Debug|Win32.ActiveCfg = Debug|Win32 {046110C9-CD5B-404D-B197-E295656CBF7F}.Debug|Win32.Build.0 = Debug|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.DebugDll|Win32.ActiveCfg = DebugDll|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.DebugDll|Win32.Build.0 = DebugDll|Win32 {046110C9-CD5B-404D-B197-E295656CBF7F}.MemDebug|Win32.ActiveCfg = Debug|Win32 {046110C9-CD5B-404D-B197-E295656CBF7F}.MemDebug|Win32.Build.0 = Debug|Win32 {046110C9-CD5B-404D-B197-E295656CBF7F}.Release|Win32.ActiveCfg = Release|Win32 {046110C9-CD5B-404D-B197-E295656CBF7F}.Release|Win32.Build.0 = Release|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/IPhreeqc.vcproj b/IPhreeqc.vcproj index 5b86b38d..6e2dc740 100644 --- a/IPhreeqc.vcproj +++ b/IPhreeqc.vcproj @@ -16,8 +16,8 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -280,6 +445,26 @@ CompileAs="2" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IPhreeqc.vcproj.GS.charlton.user b/IPhreeqc.vcproj.GS.charlton.user index f1aa731b..1ea8812f 100644 --- a/IPhreeqc.vcproj.GS.charlton.user +++ b/IPhreeqc.vcproj.GS.charlton.user @@ -89,5 +89,61 @@ MPIAcceptFilter="" /> + + + + + + diff --git a/include/IPhreeqc.h b/include/IPhreeqc.h index 0857760d..28a48068 100644 --- a/include/IPhreeqc.h +++ b/include/IPhreeqc.h @@ -5,6 +5,12 @@ #include "Var.h" +#if defined(_WINDLL) +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT +#endif + /*! \brief Enumeration used to return error codes. */ typedef enum { @@ -29,11 +35,11 @@ extern "C" { * Internally used to create an error condition. * @internal */ - int AddError(int id, const char* error_msg); + DLL_EXPORT int AddError(int id, const char* error_msg); - int CreateIPhreeqc(void); + DLL_EXPORT int CreateIPhreeqc(void); - IPQ_RESULT DestroyIPhreeqc(int id); + DLL_EXPORT IPQ_RESULT DestroyIPhreeqc(int id); /** * Load the specified database file into phreeqc. @@ -55,7 +61,7 @@ extern "C" { * * @endhtmlonly */ - int LoadDatabase(int id, const char* filename); + DLL_EXPORT int LoadDatabase(int id, const char* filename); /** * Load the specified string as a database into phreeqc. @@ -75,14 +81,14 @@ extern "C" { * * @endhtmlonly */ - int LoadDatabaseString(int id, const char* input); + DLL_EXPORT int LoadDatabaseString(int id, const char* input); /** * Unload any database currently loaded into phreeqc. * @remarks * Any previous database definitions are cleared. */ - int UnLoadDatabase(int id); + DLL_EXPORT int UnLoadDatabase(int id); /** * Output the error messages normally stored in the phreeqc.err file to stdout. @@ -96,19 +102,19 @@ extern "C" { * * @endhtmlonly */ - void OutputLastError(int id); + DLL_EXPORT void OutputLastError(int id); - void OutputLastWarning(int id); + DLL_EXPORT void OutputLastWarning(int id); - const char* GetLastErrorString(int id); + DLL_EXPORT const char* GetLastErrorString(int id); - const char* GetLastWarningString(int id); + DLL_EXPORT const char* GetLastWarningString(int id); - const char* GetDumpString(int id); + DLL_EXPORT const char* GetDumpString(int id); - int GetDumpLineCount(int id); + DLL_EXPORT int GetDumpLineCount(int id); - const char* GetDumpLine(int id, int n); + DLL_EXPORT const char* GetDumpLine(int id, int n); /** * Accumlulate lines for input to phreeqc. @@ -127,7 +133,7 @@ extern "C" { * * @endhtmlonly */ - IPQ_RESULT AccumulateLine(int id, const char *line); + DLL_EXPORT IPQ_RESULT AccumulateLine(int id, const char *line); /** * Sets the selected_output flag on or off @@ -143,8 +149,8 @@ extern "C" { * * @endhtmlonly */ - int GetSelectedOutputOn(int id); - IPQ_RESULT SetSelectedOutputOn(int id, int value); + DLL_EXPORT int GetSelectedOutputOn(int id); + DLL_EXPORT IPQ_RESULT SetSelectedOutputOn(int id, int value); /** * Sets the output flag on or off @@ -160,8 +166,8 @@ extern "C" { * * @endhtmlonly */ - int GetOutputOn(int id); - IPQ_RESULT SetOutputOn(int id, int value); + DLL_EXPORT int GetOutputOn(int id); + DLL_EXPORT IPQ_RESULT SetOutputOn(int id, int value); /** * Sets the error flag on or off @@ -177,8 +183,8 @@ extern "C" { * * @endhtmlonly */ - int GetErrorOn(int id); - IPQ_RESULT SetErrorOn(int id, int value); + DLL_EXPORT int GetErrorOn(int id); + DLL_EXPORT IPQ_RESULT SetErrorOn(int id, int value); /** * Sets the log flag on or off @@ -194,8 +200,8 @@ extern "C" { * * @endhtmlonly */ - int GetLogOn(int id); - IPQ_RESULT SetLogOn(int id, int value); + DLL_EXPORT int GetLogOn(int id); + DLL_EXPORT IPQ_RESULT SetLogOn(int id, int value); /** * Sets the dump flag on or off @@ -211,8 +217,8 @@ extern "C" { * * @endhtmlonly */ - int GetDumpOn(int id); - IPQ_RESULT SetDumpOn(int id, int value); + DLL_EXPORT int GetDumpOn(int id); + DLL_EXPORT IPQ_RESULT SetDumpOn(int id, int value); /** * Sets the dump string flag on or off @@ -228,8 +234,8 @@ extern "C" { * * @endhtmlonly */ - int GetDumpStringOn(int id); - IPQ_RESULT SetDumpStringOn(int id, int value); + DLL_EXPORT int GetDumpStringOn(int id); + DLL_EXPORT IPQ_RESULT SetDumpStringOn(int id, int value); /** * Runs the accumulated input sent to AccumulateLine. @@ -248,7 +254,7 @@ extern "C" { * * @endhtmlonly */ - int RunAccumulated(int id); + DLL_EXPORT int RunAccumulated(int id); /** * Runs the specified phreeqc input file. @@ -267,7 +273,7 @@ extern "C" { * * @endhtmlonly */ - int RunFile(int id, const char* filename); + DLL_EXPORT int RunFile(int id, const char* filename); /** * Runs the specified string as input to phreeqc. @@ -286,7 +292,7 @@ extern "C" { * * @endhtmlonly */ - int RunString(int id, const char* input); + DLL_EXPORT int RunString(int id, const char* input); /** * Returns the number of rows currently contained within selected_output. @@ -301,7 +307,7 @@ extern "C" { * * @endhtmlonly */ - int GetSelectedOutputRowCount(int id); + DLL_EXPORT int GetSelectedOutputRowCount(int id); /** * Returns the number of columns currently contained within selected_output. @@ -316,7 +322,7 @@ extern "C" { * * @endhtmlonly */ - int GetSelectedOutputColumnCount(int id); + DLL_EXPORT int GetSelectedOutputColumnCount(int id); /** * Returns the \c VAR associated with the specified row and column. @@ -483,7 +489,7 @@ Headings * * @endhtmlonly */ - IPQ_RESULT GetSelectedOutputValue(int id, int row, int col, VAR* pVAR); + DLL_EXPORT IPQ_RESULT GetSelectedOutputValue(int id, int row, int col, VAR* pVAR); /** * TODO @@ -498,7 +504,7 @@ Headings * * @endhtmlonly */ - int GetComponentCount(int id); + DLL_EXPORT int GetComponentCount(int id); /** * TODO @@ -513,7 +519,7 @@ Headings * * @endhtmlonly */ - const char* GetComponent(int id, int n); + DLL_EXPORT const char* GetComponent(int id, int n); /** * Send the accumulated input to stdout. @@ -528,7 +534,7 @@ Headings * * @endhtmlonly */ - void OutputLines(int id); + DLL_EXPORT void OutputLines(int id); // TODO int RunWithCallback(PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie, int output_on, int error_on, int log_on, int selected_output_on); @@ -547,7 +553,7 @@ Headings * * @endhtmlonly */ -int GetErrorLineCount(int id); + DLL_EXPORT int GetErrorLineCount(int id); /** * TODO @@ -563,7 +569,7 @@ int GetErrorLineCount(int id); * * @endhtmlonly */ -const char* GetErrorLine(int id, int n); + DLL_EXPORT const char* GetErrorLine(int id, int n); /** * TODO @@ -578,7 +584,7 @@ const char* GetErrorLine(int id, int n); * * @endhtmlonly */ -int GetWarningLineCount(int id); + DLL_EXPORT int GetWarningLineCount(int id); /** * TODO @@ -594,7 +600,7 @@ int GetWarningLineCount(int id); * * @endhtmlonly */ -const char* GetWarningLine(int id, int n); + DLL_EXPORT const char* GetWarningLine(int id, int n); diff --git a/include/IPhreeqc.hpp b/include/IPhreeqc.hpp index a4a0d13c..b37669af 100644 --- a/include/IPhreeqc.hpp +++ b/include/IPhreeqc.hpp @@ -8,15 +8,21 @@ #include "IPhreeqcCallbacks.h" /* PFN_PRERUN_CALLBACK, PFN_POSTRUN_CALLBACK, PFN_CATCH_CALLBACK */ #include "Var.h" /* VRESULT */ +#if defined(_WINDLL) +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT +#endif + class Phreeqc; class IErrorReporter; class CSelectedOutput; -class IPhreeqcStop : std::exception +class DLL_EXPORT IPhreeqcStop : std::exception { }; -class IPhreeqc +class DLL_EXPORT IPhreeqc { public: IPhreeqc(void); @@ -134,6 +140,13 @@ private: friend class TestSelectedOutput; #endif Phreeqc* PhreeqcPtr; + +private: + // copy ctor not supported + IPhreeqc(const IPhreeqc&); + + // operator= not supported + IPhreeqc& operator=(const IPhreeqc&); }; #endif // INC_IPHREEQC_HPP \ No newline at end of file diff --git a/src/fwrap.cpp b/src/fwrap.cpp index fc5c531f..f3c84623 100644 --- a/src/fwrap.cpp +++ b/src/fwrap.cpp @@ -360,103 +360,103 @@ extern "C" { // // Intel Fortran compiler 9.1 /iface:cvf // -int __stdcall CREATEIPHREEQC(void) +DLL_EXPORT int __stdcall CREATEIPHREEQC(void) { return CreateIPhreeqcF(); } -int __stdcall LOADDATABASE(int *id, char *filename, unsigned int len) +DLL_EXPORT int __stdcall LOADDATABASE(int *id, char *filename, unsigned int len) { return LoadDatabaseF(id, filename, len); } -void __stdcall OUTPUTLASTERROR(int *id) +DLL_EXPORT void __stdcall OUTPUTLASTERROR(int *id) { OutputLastErrorF(id); } -int __stdcall ACCUMULATELINE(int *id, char *line, unsigned int len) +DLL_EXPORT int __stdcall ACCUMULATELINE(int *id, char *line, unsigned int len) { return AccumulateLineF(id, line, len); } -void __stdcall SETSELECTEDOUTPUTON(int *id, int *selected_on) +DLL_EXPORT void __stdcall SETSELECTEDOUTPUTON(int *id, int *selected_on) { SetSelectedOutputOnF(id, selected_on); } -void __stdcall SETOUTPUTON(int *id, int *output_on) +DLL_EXPORT void __stdcall SETOUTPUTON(int *id, int *output_on) { SetOutputOnF(id, output_on); } -void __stdcall SETERRORON(int *id, int *error_on) +DLL_EXPORT void __stdcall SETERRORON(int *id, int *error_on) { SetErrorOnF(id, error_on); } -void __stdcall SETLOGON(int *id, int *log_on) +DLL_EXPORT void __stdcall SETLOGON(int *id, int *log_on) { SetLogOnF(id, log_on); } -void __stdcall SETDUMPON(int *id, int *dump_on) +DLL_EXPORT void __stdcall SETDUMPON(int *id, int *dump_on) { SetDumpOnF(id, dump_on); } -void __stdcall SETDUMPSTRINGON(int *id, int *dump_string_on) +DLL_EXPORT void __stdcall SETDUMPSTRINGON(int *id, int *dump_string_on) { SetDumpStringOnF(id, dump_string_on); } -int __stdcall GETDUMPLINECOUNT(int *id) +DLL_EXPORT int __stdcall GETDUMPLINECOUNT(int *id) { return GetDumpLineCountF(id); } -void __stdcall GETDUMPLINE(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void __stdcall GETDUMPLINE(int *id, int *n, char* line, unsigned int line_length) { GetDumpLineF(id, n, line, line_length); } -int __stdcall GETERRORLINECOUNT(int *id) +DLL_EXPORT int __stdcall GETERRORLINECOUNT(int *id) { return GetErrorLineCountF(id); } -void __stdcall GETERRORLINE(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void __stdcall GETERRORLINE(int *id, int *n, char* line, unsigned int line_length) { GetErrorLineF(id, n, line, line_length); } -int __stdcall GETWARNINGLINECOUNT(int *id) +DLL_EXPORT int __stdcall GETWARNINGLINECOUNT(int *id) { return GetWarningLineCountF(id); } -void __stdcall GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void __stdcall GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length) { GetWarningLineF(id, n, line, line_length); } -int __stdcall GETCOMPONENTCOUNT(int *id) +DLL_EXPORT int __stdcall GETCOMPONENTCOUNT(int *id) { return GetComponentCountF(id); } -void __stdcall GETCOMPONENT(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void __stdcall GETCOMPONENT(int *id, int *n, char* line, unsigned int line_length) { GetComponentF(id, n, line, line_length); } -int __stdcall RUNACCUMULATED(int *id) +DLL_EXPORT int __stdcall RUNACCUMULATED(int *id) { return RunAccumulatedF(id); } -int __stdcall RUNFILE(int *id, char *filename, unsigned int len) +DLL_EXPORT int __stdcall RUNFILE(int *id, char *filename, unsigned int len) { return RunFileF(id, filename, len); } -int __stdcall RUNSTRING(int *id, char *input, unsigned int len) +DLL_EXPORT int __stdcall RUNSTRING(int *id, char *input, unsigned int len) { return RunStringF(id, input, len); } -void __stdcall OUTPUTLINES(int *id) +DLL_EXPORT void __stdcall OUTPUTLINES(int *id) { OutputLinesF(id); } -int __stdcall GETSELECTEDOUTPUTROWCOUNT(int *id) +DLL_EXPORT int __stdcall GETSELECTEDOUTPUTROWCOUNT(int *id) { return GetSelectedOutputRowCountF(id); } -int __stdcall GETSELECTEDOUTPUTCOLUMNCOUNT(int *id) +DLL_EXPORT int __stdcall GETSELECTEDOUTPUTCOLUMNCOUNT(int *id) { return GetSelectedOutputColumnCountF(id); } -int __stdcall GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length) +DLL_EXPORT int __stdcall GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length) { return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length); } diff --git a/src/fwrap.h b/src/fwrap.h index d69436e9..82506ce3 100644 --- a/src/fwrap.h +++ b/src/fwrap.h @@ -1,6 +1,11 @@ #ifndef __FWRAP__H #define __FWRAP__H +#if defined(_WINDLL) +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT +#endif #if defined(__cplusplus) extern "C" { diff --git a/src/fwrap2.cpp b/src/fwrap2.cpp index 598a2fcb..e60b645e 100644 --- a/src/fwrap2.cpp +++ b/src/fwrap2.cpp @@ -10,103 +10,103 @@ extern "C" { // // Intel Fortran compiler 9.1 /iface:cvf // -int CREATEIPHREEQC(void) +DLL_EXPORT int CREATEIPHREEQC(void) { return CreateIPhreeqcF(); } -int LOADDATABASE(int *id, char *filename, unsigned int len) +DLL_EXPORT int LOADDATABASE(int *id, char *filename, unsigned int len) { return LoadDatabaseF(id, filename, len); } -void OUTPUTLASTERROR(int *id) +DLL_EXPORT void OUTPUTLASTERROR(int *id) { OutputLastErrorF(id); } -int ACCUMULATELINE(int *id, char *line, unsigned int len) +DLL_EXPORT int ACCUMULATELINE(int *id, char *line, unsigned int len) { return AccumulateLineF(id, line, len); } -void SETSELECTEDOUTPUTON(int *id, int *selected_on) +DLL_EXPORT void SETSELECTEDOUTPUTON(int *id, int *selected_on) { SetSelectedOutputOnF(id, selected_on); } -void SETOUTPUTON(int *id, int *output_on) +DLL_EXPORT void SETOUTPUTON(int *id, int *output_on) { SetOutputOnF(id, output_on); } -void SETERRORON(int *id, int *error_on) +DLL_EXPORT void SETERRORON(int *id, int *error_on) { SetErrorOnF(id, error_on); } -void SETLOGON(int *id, int *log_on) +DLL_EXPORT void SETLOGON(int *id, int *log_on) { SetLogOnF(id, log_on); } -void SETDUMPON(int *id, int *dump_on) +DLL_EXPORT void SETDUMPON(int *id, int *dump_on) { SetDumpOnF(id, dump_on); } -void SETDUMPSTRINGON(int *id, int *dump_string_on) +DLL_EXPORT void SETDUMPSTRINGON(int *id, int *dump_string_on) { SetDumpStringOnF(id, dump_string_on); } -int GETDUMPLINECOUNT(int *id) +DLL_EXPORT int GETDUMPLINECOUNT(int *id) { return GetDumpLineCountF(id); } -void GETDUMPLINE(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void GETDUMPLINE(int *id, int *n, char* line, unsigned int line_length) { GetDumpLineF(id, n, line, line_length); } -int GETERRORLINECOUNT(int *id) +DLL_EXPORT int GETERRORLINECOUNT(int *id) { return GetErrorLineCountF(id); } -void GETERRORLINE(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void GETERRORLINE(int *id, int *n, char* line, unsigned int line_length) { GetErrorLineF(id, n, line, line_length); } -int GETWARNINGLINECOUNT(int *id) +DLL_EXPORT int GETWARNINGLINECOUNT(int *id) { return GetWarningLineCountF(id); } -void GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length) { GetWarningLineF(id, n, line, line_length); } -int GETCOMPONENTCOUNT(int *id) +DLL_EXPORT int GETCOMPONENTCOUNT(int *id) { return GetComponentCountF(id); } -void GETCOMPONENT(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void GETCOMPONENT(int *id, int *n, char* line, unsigned int line_length) { GetComponentF(id, n, line, line_length); } -int RUNACCUMULATED(int *id) +DLL_EXPORT int RUNACCUMULATED(int *id) { return RunAccumulatedF(id); } -int RUNFILE(int *id, char *filename, unsigned int len) +DLL_EXPORT int RUNFILE(int *id, char *filename, unsigned int len) { return RunFileF(id, filename, len); } -int RUNSTRING(int *id, char *input, unsigned int len) +DLL_EXPORT int RUNSTRING(int *id, char *input, unsigned int len) { return RunStringF(id, input, len); } -void OUTPUTLINES(int *id) +DLL_EXPORT void OUTPUTLINES(int *id) { OutputLinesF(id); } -int GETSELECTEDOUTPUTROWCOUNT(int *id) +DLL_EXPORT int GETSELECTEDOUTPUTROWCOUNT(int *id) { return GetSelectedOutputRowCountF(id); } -int GETSELECTEDOUTPUTCOLUMNCOUNT(int *id) +DLL_EXPORT int GETSELECTEDOUTPUTCOLUMNCOUNT(int *id) { return GetSelectedOutputColumnCountF(id); } -int GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length) +DLL_EXPORT int GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length) { return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length); } diff --git a/src/fwrap3.cpp b/src/fwrap3.cpp index 423066f0..cad155e0 100644 --- a/src/fwrap3.cpp +++ b/src/fwrap3.cpp @@ -10,103 +10,103 @@ extern "C" { // // Intel Fortran compiler 9.1 /iface:cref /assume:underscore // -int createiphreeqc_(void) +DLL_EXPORT int createiphreeqc_(void) { return CreateIPhreeqcF(); } -int loaddatabase_(int *id, char *filename, unsigned int len) +DLL_EXPORT int loaddatabase_(int *id, char *filename, unsigned int len) { return LoadDatabaseF(id, filename, len); } -void outputlasterror_(int *id) +DLL_EXPORT void outputlasterror_(int *id) { OutputLastErrorF(id); } -int accumulateline_(int *id, char *line, unsigned int len) +DLL_EXPORT int accumulateline_(int *id, char *line, unsigned int len) { return AccumulateLineF(id, line, len); } -void setselectedoutputon_(int *id, int *selected_on) +DLL_EXPORT void setselectedoutputon_(int *id, int *selected_on) { SetSelectedOutputOnF(id, selected_on); } -void setoutputon_(int *id, int *output_on) +DLL_EXPORT void setoutputon_(int *id, int *output_on) { SetOutputOnF(id, output_on); } -void seterroron_(int *id, int *error_on) +DLL_EXPORT void seterroron_(int *id, int *error_on) { SetErrorOnF(id, error_on); } -void setlogon_(int *id, int *log_on) +DLL_EXPORT void setlogon_(int *id, int *log_on) { SetLogOnF(id, log_on); } -void setdumpon_(int *id, int *dump_on) +DLL_EXPORT void setdumpon_(int *id, int *dump_on) { SetLogOnF(id, dump_on); } -void setdumpstringon_(int *id, int *dump_string_on) +DLL_EXPORT void setdumpstringon_(int *id, int *dump_string_on) { SetDumpStringOnF(id, dump_string_on); } -int getdumplinecount_(int *id) +DLL_EXPORT int getdumplinecount_(int *id) { return GetDumpLineCountF(id); } -void getdumpline_(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void getdumpline_(int *id, int *n, char* line, unsigned int line_length) { GetDumpLineF(id, n, line, line_length); } -int geterrorlinecount_(int *id) +DLL_EXPORT int geterrorlinecount_(int *id) { return GetErrorLineCountF(id); } -void geterrorline_(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void geterrorline_(int *id, int *n, char* line, unsigned int line_length) { GetErrorLineF(id, n, line, line_length); } -int getwarninglinecount_(int *id) +DLL_EXPORT int getwarninglinecount_(int *id) { return GetWarningLineCountF(id); } -void getwarningline_(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void getwarningline_(int *id, int *n, char* line, unsigned int line_length) { GetWarningLineF(id, n, line, line_length); } -int getcomponentcount_(int *id) +DLL_EXPORT int getcomponentcount_(int *id) { return GetComponentCountF(id); } -void getcomponent_(int *id, int *n, char* line, unsigned int line_length) +DLL_EXPORT void getcomponent_(int *id, int *n, char* line, unsigned int line_length) { GetComponentF(id, n, line, line_length); } -int runaccumulated_(int *id) +DLL_EXPORT int runaccumulated_(int *id) { return RunAccumulatedF(id); } -int runfile_(int *id, char *filename, unsigned int len) +DLL_EXPORT int runfile_(int *id, char *filename, unsigned int len) { return RunFileF(id, filename, len); } -int runstring_(int *id, char *input, unsigned int len) +DLL_EXPORT int runstring_(int *id, char *input, unsigned int len) { return RunStringF(id, input, len); } -void outputlines_(int *id) +DLL_EXPORT void outputlines_(int *id) { OutputLinesF(id); } -int getselectedoutputrowcount_(int *id) +DLL_EXPORT int getselectedoutputrowcount_(int *id) { return GetSelectedOutputRowCountF(id); } -int getselectedoutputcolumncount_(int *id) +DLL_EXPORT int getselectedoutputcolumncount_(int *id) { return GetSelectedOutputColumnCountF(id); } -int getselectedoutputvalue_(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length) +DLL_EXPORT int getselectedoutputvalue_(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length) { return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length); } diff --git a/test/test.vfproj b/test/test.vfproj index 7d32a223..9e838c7d 100644 --- a/test/test.vfproj +++ b/test/test.vfproj @@ -21,7 +21,8 @@ - + + @@ -30,7 +31,28 @@ - + + + + + + + + + + + + + + + + + + + + + + diff --git a/test2/test2.vfproj b/test2/test2.vfproj index ce3b8cea..c3c9987d 100644 --- a/test2/test2.vfproj +++ b/test2/test2.vfproj @@ -11,7 +11,8 @@ - + + @@ -20,7 +21,8 @@ - + + @@ -29,7 +31,28 @@ - + + + + + + + + + + + + + + + + + + + + + + diff --git a/testcpp/testcpp.cpp b/testcpp/testcpp.cpp index 195b631f..46ab08e4 100644 --- a/testcpp/testcpp.cpp +++ b/testcpp/testcpp.cpp @@ -1,10 +1,37 @@ #include +#include + #include int main(int argc, char* argv[]) { IPhreeqc obj; + + assert(obj.GetOutputOn() == false); obj.SetOutputOn(true); + assert(obj.GetOutputOn() == true); + + assert(obj.GetErrorOn() == false); + obj.SetErrorOn(true); + assert(obj.GetErrorOn() == true); + + assert(obj.GetSelectedOutputOn() == false); + obj.SetSelectedOutputOn(true); + assert(obj.GetSelectedOutputOn() == true); + + assert(obj.GetDumpOn() == false); + obj.SetDumpOn(true); + assert(obj.GetDumpOn() == true); + + assert(obj.GetDumpStringOn() == false); + obj.SetDumpStringOn(true); + assert(obj.GetDumpStringOn() == true); + + assert(obj.GetLogOn() == false); + obj.SetLogOn(true); + assert(obj.GetLogOn() == true); + + if (obj.LoadDatabase("phreeqc.dat")) { goto error; diff --git a/testcpp/testcpp.vcproj b/testcpp/testcpp.vcproj index 853b529e..83c8848e 100644 --- a/testcpp/testcpp.vcproj +++ b/testcpp/testcpp.vcproj @@ -17,7 +17,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testcpp/testcpp.vcproj.GS.charlton.user b/testcpp/testcpp.vcproj.GS.charlton.user index f50373a5..9faa0e83 100644 --- a/testcpp/testcpp.vcproj.GS.charlton.user +++ b/testcpp/testcpp.vcproj.GS.charlton.user @@ -61,5 +61,61 @@ MPIAcceptFilter="" /> + + + + + + diff --git a/unit/unit.vcproj b/unit/unit.vcproj index 44fc6aac..2b1188c7 100644 --- a/unit/unit.vcproj +++ b/unit/unit.vcproj @@ -16,7 +16,7 @@