From e3b0b57db2c1a776b50cdc75f5258e84b74cd201 Mon Sep 17 00:00:00 2001 From: pcroth Date: Thu, 1 Feb 2001 16:22:41 +0000 Subject: [PATCH] Added DLL linkage specification to class declarations to support building library as a DLL under Windows NT. --- dyninstAPI/h/BPatch.h | 3 +- dyninstAPI/h/BPatch_Set.h | 3 +- dyninstAPI/h/BPatch_Vector.h | 5 ++- dyninstAPI/h/BPatch_basicBlock.h | 3 +- dyninstAPI/h/BPatch_basicBlockLoop.h | 3 +- dyninstAPI/h/BPatch_dll.h | 78 ++++++++++++++++++++++++++++++++++++ dyninstAPI/h/BPatch_flowGraph.h | 3 +- dyninstAPI/h/BPatch_function.h | 3 +- dyninstAPI/h/BPatch_image.h | 3 +- dyninstAPI/h/BPatch_module.h | 3 +- dyninstAPI/h/BPatch_point.h | 4 +- dyninstAPI/h/BPatch_snippet.h | 27 +++++++------ dyninstAPI/h/BPatch_sourceBlock.h | 3 +- dyninstAPI/h/BPatch_sourceObj.h | 3 +- dyninstAPI/h/BPatch_thread.h | 6 ++- dyninstAPI/h/BPatch_type.h | 10 +++-- 16 files changed, 128 insertions(+), 32 deletions(-) create mode 100644 dyninstAPI/h/BPatch_dll.h diff --git a/dyninstAPI/h/BPatch.h b/dyninstAPI/h/BPatch.h index 44967c9..2b90ecb 100644 --- a/dyninstAPI/h/BPatch.h +++ b/dyninstAPI/h/BPatch.h @@ -43,6 +43,7 @@ #define _BPatch_h_ #include +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_thread.h" #include "BPatch_type.h" @@ -69,7 +70,7 @@ typedef void (*BPatchExecCallback)(BPatch_thread *proc); typedef void (*BPatchExitCallback)(BPatch_thread *proc, int code); -class BPatch { +class BPATCH_DLL_EXPORT BPatch { friend class BPatch_thread; friend class process; diff --git a/dyninstAPI/h/BPatch_Set.h b/dyninstAPI/h/BPatch_Set.h index 43e5ac2..12ee97e 100644 --- a/dyninstAPI/h/BPatch_Set.h +++ b/dyninstAPI/h/BPatch_Set.h @@ -11,6 +11,7 @@ #include #include +#include "BPatch_dll.h" #if !defined(DO_INLINE_P) #define DO_INLINE_P @@ -56,7 +57,7 @@ static const bool BLACK = false; #endif template > -class BPatch_Set { +class BPATCH_DLL_EXPORT BPatch_Set { private: #ifndef i386_unknown_nt4_0 diff --git a/dyninstAPI/h/BPatch_Vector.h b/dyninstAPI/h/BPatch_Vector.h index 5533cd0..e607a44 100644 --- a/dyninstAPI/h/BPatch_Vector.h +++ b/dyninstAPI/h/BPatch_Vector.h @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_Vector.h,v 1.5 1999/07/08 00:18:45 nash Exp $ +// $Id: BPatch_Vector.h,v 1.6 2001/02/01 16:22:41 pcroth Exp $ #ifndef _BPatch_Vector_h_ #define _BPatch_Vector_h_ @@ -47,13 +47,14 @@ #include #include #include +#include "BPatch_dll.h" #ifdef external_templates #pragma interface #endif /* external_templates */ template -class BPatch_Vector { +class BPATCH_DLL_EXPORT BPatch_Vector { int reserved; // Number of objects for which space is reserved int len; // The current number of objects in the vector T* data; // Points to the array of objects diff --git a/dyninstAPI/h/BPatch_basicBlock.h b/dyninstAPI/h/BPatch_basicBlock.h index 3b6230c..6fcf7cf 100644 --- a/dyninstAPI/h/BPatch_basicBlock.h +++ b/dyninstAPI/h/BPatch_basicBlock.h @@ -1,6 +1,7 @@ #ifndef _BPatch_basicBlock_h_ #define _BPatch_basicBlock_h_ +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_Set.h" #include "BPatch_sourceBlock.h" @@ -15,7 +16,7 @@ * @see BPatch_basicBlockLoop */ -class BPatch_basicBlock { +class BPATCH_DLL_EXPORT BPatch_basicBlock { friend class BPatch_flowGraph; friend class TarjanDominator; diff --git a/dyninstAPI/h/BPatch_basicBlockLoop.h b/dyninstAPI/h/BPatch_basicBlockLoop.h index f27247a..f98e363 100644 --- a/dyninstAPI/h/BPatch_basicBlockLoop.h +++ b/dyninstAPI/h/BPatch_basicBlockLoop.h @@ -2,6 +2,7 @@ #define _BPatch_basicBlockLoop_h #include +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_Set.h" #include "BPatch_basicBlock.h" @@ -15,7 +16,7 @@ class BPatch_variableExpr; -class BPatch_basicBlockLoop { +class BPATCH_DLL_EXPORT BPatch_basicBlockLoop { friend class BPatch_flowGraph; friend ostream& operator<<(ostream&,BPatch_basicBlockLoop&); diff --git a/dyninstAPI/h/BPatch_dll.h b/dyninstAPI/h/BPatch_dll.h new file mode 100644 index 0000000..339a85c --- /dev/null +++ b/dyninstAPI/h/BPatch_dll.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1996 Barton P. Miller + * + * We provide the Paradyn Parallel Performance Tools (below + * described as Paradyn") on an AS IS basis, and do not warrant its + * validity or performance. We reserve the right to update, modify, + * or discontinue this software at any time. We shall have no + * obligation to supply such updates or modifications or any other + * form of support to you. + * + * This license is for research uses. For such uses, there is no + * charge. We define "research use" to mean you may freely use it + * inside your organization for whatever purposes you see fit. But you + * may not re-distribute Paradyn or parts of Paradyn, in any form + * source or binary (including derivatives), electronic or otherwise, + * to any other organization or entity without our permission. + * + * (for other uses, please contact us at paradyn@cs.wisc.edu) + * + * All warranties, including without limitation, any warranty of + * merchantability or fitness for a particular purpose, are hereby + * excluded. + * + * By your use of Paradyn, you understand and agree that we (or any + * other person or entity with proprietary rights in Paradyn) are + * under no obligation to provide either maintenance services, + * update services, notices of latent defects, or correction of + * defects for Paradyn. + * + * Even if advised of the possibility of such damages, under no + * circumstances shall we (or any other person or entity with + * proprietary rights in the software licensed hereunder) be liable + * to you or any third party for direct, indirect, or consequential + * damages of any character regardless of type of action, including, + * without limitation, loss of profits, loss of use, loss of good + * will, or computer failure or malfunction. You agree to indemnify + * us (and any other person or entity with proprietary rights in the + * software licensed hereunder) for any and all liability it may + * incur to third parties resulting from your use of Paradyn. + */ +#ifndef _BPatch_dll_h_ +#define _BPatch_dll_h_ + +#ifdef i386_unknown_nt4_0 +// we are building for a Windows target + +// we get numerous spurious warnings about having some template classes +// needing to have a dll-interface if instances of these classes are +// to be used by classes whose public interfaces are exported from a DLL. +// Specifing the template classes with a DLL export interface doesn't +// satisfy the compiler. Until the compiler handles instantiated +// templates exported from DLLs better, we disable the warning when building +// or using the dyninstAPI DLL. +// +#pragma warning(disable:4251) + +#ifdef BPATCH_DLL_BUILD +// we are building the dyninstAPI DLL +#define BPATCH_DLL_EXPORT __declspec(dllexport) + +#else + +// we are not building the dyninstAPI DLL +#define BPATCH_DLL_EXPORT __declspec(dllimport) +#endif // BPATCH_DLL_BUILD + +#else + +// we are not building for a Windows target +#define BPATCH_DLL_EXPORT + +#endif + + +// declare our version string +extern "C" BPATCH_DLL_EXPORT const char V_libdyninstAPI[]; + +#endif /* _BPatch_dll_h_ */ diff --git a/dyninstAPI/h/BPatch_flowGraph.h b/dyninstAPI/h/BPatch_flowGraph.h index c7b7984..90a8238 100644 --- a/dyninstAPI/h/BPatch_flowGraph.h +++ b/dyninstAPI/h/BPatch_flowGraph.h @@ -1,6 +1,7 @@ #ifndef _BPatch_flowGraph_h_ #define _BPatch_flowGraph_h_ +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_Set.h" #include "BPatch_basicBlock.h" @@ -14,7 +15,7 @@ class BPatch_image; * @see BPatch_basicBlock * @see BPatch_basicBlockLoop */ -class BPatch_flowGraph { +class BPATCH_DLL_EXPORT BPatch_flowGraph { friend class BPatch_function; friend class BPatch_basicBlock; friend ostream& operator<<(ostream&,BPatch_flowGraph&); diff --git a/dyninstAPI/h/BPatch_function.h b/dyninstAPI/h/BPatch_function.h index 2243843..998b0db 100644 --- a/dyninstAPI/h/BPatch_function.h +++ b/dyninstAPI/h/BPatch_function.h @@ -42,6 +42,7 @@ #ifndef _BPatch_function_h_ #define _BPatch_function_h_ +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_point.h" #include "BPatch_type.h" @@ -56,7 +57,7 @@ class BPatch_function; class BPatch_point; class BPatch_flowGraph; -class BPatch_function: public BPatch_sourceObj { +class BPATCH_DLL_EXPORT BPatch_function: public BPatch_sourceObj { friend class BPatch_flowGraph; process *proc; diff --git a/dyninstAPI/h/BPatch_image.h b/dyninstAPI/h/BPatch_image.h index 99a7f94..89258d8 100644 --- a/dyninstAPI/h/BPatch_image.h +++ b/dyninstAPI/h/BPatch_image.h @@ -42,6 +42,7 @@ #ifndef _BPatch_image_h_ #define _BPatch_image_h_ +#include "BPatch_dll.h" #include "BPatch_sourceObj.h" #include "BPatch_Vector.h" #include "BPatch_point.h" @@ -54,7 +55,7 @@ class image; class AddrToVarExprHash; -class BPatch_image: public BPatch_sourceObj { +class BPATCH_DLL_EXPORT BPatch_image: public BPatch_sourceObj { process *proc; public: diff --git a/dyninstAPI/h/BPatch_module.h b/dyninstAPI/h/BPatch_module.h index c2bd39c..55950b8 100644 --- a/dyninstAPI/h/BPatch_module.h +++ b/dyninstAPI/h/BPatch_module.h @@ -42,6 +42,7 @@ #ifndef _BPatch_module_h_ #define _BPatch_module_h_ +#include "BPatch_dll.h" #include #include @@ -55,7 +56,7 @@ class LineInformation; extern BPatch_builtInTypeCollection * builtInTypes; -class BPatch_module: public BPatch_sourceObj { +class BPATCH_DLL_EXPORT BPatch_module: public BPatch_sourceObj { friend class BPatch_function; friend class BPatch_image; diff --git a/dyninstAPI/h/BPatch_point.h b/dyninstAPI/h/BPatch_point.h index 89cc35f..337e4ad 100644 --- a/dyninstAPI/h/BPatch_point.h +++ b/dyninstAPI/h/BPatch_point.h @@ -42,6 +42,8 @@ #ifndef _BPatch_point_h_ #define _BPatch_point_h_ +#include "BPatch_dll.h" + class process; class instPoint; class BPatch_thread; @@ -63,7 +65,7 @@ typedef enum { } BPatch_procedureLocation; -class BPatch_point { +class BPATCH_DLL_EXPORT BPatch_point { friend class BPatch_thread; friend class BPatch_image; friend class BPatch_function; diff --git a/dyninstAPI/h/BPatch_snippet.h b/dyninstAPI/h/BPatch_snippet.h index dffe515..42b81a4 100644 --- a/dyninstAPI/h/BPatch_snippet.h +++ b/dyninstAPI/h/BPatch_snippet.h @@ -42,6 +42,7 @@ #ifndef _BPatch_snippet_h_ #define _BPatch_snippet_h_ +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_sourceObj.h" #include "BPatch_point.h" @@ -80,7 +81,7 @@ typedef enum { BPatch_deref } BPatch_unOp; -class BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_snippet { public: // The following members are for internal use by the library only: AstNode *ast; /* XXX It would be better if this was protected */ @@ -95,7 +96,7 @@ public: float getCost(); }; -class BPatch_arithExpr: public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_arithExpr: public BPatch_snippet { public: BPatch_arithExpr(BPatch_binOp op, const BPatch_snippet &lOperand, @@ -103,13 +104,13 @@ public: BPatch_arithExpr(BPatch_unOp op, const BPatch_snippet &lOperand); }; -class BPatch_boolExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_boolExpr : public BPatch_snippet { public: BPatch_boolExpr(BPatch_relOp op, const BPatch_snippet &lOperand, const BPatch_snippet &rOperand); }; -class BPatch_constExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_constExpr : public BPatch_snippet { public: BPatch_constExpr(int value); #ifdef BPATCH_NOT_YET @@ -119,18 +120,18 @@ public: BPatch_constExpr(const void *value); }; -class BPatch_funcCallExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_funcCallExpr : public BPatch_snippet { public: BPatch_funcCallExpr(const BPatch_function& func, const BPatch_Vector &args); }; -class BPatch_funcJumpExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_funcJumpExpr : public BPatch_snippet { public: BPatch_funcJumpExpr(const BPatch_function& func); }; -class BPatch_ifExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_ifExpr : public BPatch_snippet { public: BPatch_ifExpr(const BPatch_boolExpr &conditional, const BPatch_snippet &tClase); @@ -139,27 +140,27 @@ public: const BPatch_snippet &fClause); }; -class BPatch_nullExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_nullExpr : public BPatch_snippet { public: BPatch_nullExpr(); }; -class BPatch_paramExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_paramExpr : public BPatch_snippet { public: BPatch_paramExpr(int n); }; -class BPatch_retExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_retExpr : public BPatch_snippet { public: BPatch_retExpr(); }; -class BPatch_sequence : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_sequence : public BPatch_snippet { public: BPatch_sequence(const BPatch_Vector &items); }; -class BPatch_variableExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_variableExpr : public BPatch_snippet { char *name; process *proc; void *address; @@ -192,7 +193,7 @@ public: BPatch_Vector *getComponents(); }; -class BPatch_breakPointExpr : public BPatch_snippet { +class BPATCH_DLL_EXPORT BPatch_breakPointExpr : public BPatch_snippet { public: BPatch_breakPointExpr(); }; diff --git a/dyninstAPI/h/BPatch_sourceBlock.h b/dyninstAPI/h/BPatch_sourceBlock.h index 59bc255..92d9a81 100644 --- a/dyninstAPI/h/BPatch_sourceBlock.h +++ b/dyninstAPI/h/BPatch_sourceBlock.h @@ -2,6 +2,7 @@ #define _BPatch_sourceBlock_h_ #include +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_Set.h" @@ -16,7 +17,7 @@ * @see BPatch_basicBlock */ -class BPatch_sourceBlock{ +class BPATCH_DLL_EXPORT BPatch_sourceBlock{ friend class BPatch_flowGraph; friend ostream& operator<<(ostream&,BPatch_sourceBlock&); diff --git a/dyninstAPI/h/BPatch_sourceObj.h b/dyninstAPI/h/BPatch_sourceObj.h index 3a9f7e6..c201905 100644 --- a/dyninstAPI/h/BPatch_sourceObj.h +++ b/dyninstAPI/h/BPatch_sourceObj.h @@ -42,6 +42,7 @@ #ifndef _BPatch_sourceObj_h_ #define _BPatch_sourceObj_h_ +#include "BPatch_dll.h" #include class BPatch_type; @@ -71,7 +72,7 @@ typedef enum BPatch_sourceType { BPatch_sourceStatement } BPatch_sourceType; -class BPatch_sourceObj { +class BPATCH_DLL_EXPORT BPatch_sourceObj { public: BPatch_sourceType getSrcType() { return _srcType; } virtual BPatch_Vector *getSourceObj() = 0; diff --git a/dyninstAPI/h/BPatch_thread.h b/dyninstAPI/h/BPatch_thread.h index a50d209..ffbc720 100644 --- a/dyninstAPI/h/BPatch_thread.h +++ b/dyninstAPI/h/BPatch_thread.h @@ -42,6 +42,7 @@ #ifndef _BPatch_thread_h_ #define _BPatch_thread_h_ + /* * The following is a kludge so that the functions that refer to signals (such * as BPatch_thread::stopSignal) can emulate the Unix behavior on Windows NT. @@ -51,6 +52,7 @@ #define SIGTRAP 5 #endif +#include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_image.h" #include "BPatch_snippet.h" @@ -85,7 +87,7 @@ typedef enum { * Contains information about the code that was inserted by an earlier call to * Bpatch_thread::insertSnippet. */ -class BPatchSnippetHandle { +class BPATCH_DLL_EXPORT BPatchSnippetHandle { friend class BPatch_thread; private: BPatch_Vector instance; @@ -101,7 +103,7 @@ public: /* * Represents a thread of execution. */ -class BPatch_thread { +class BPATCH_DLL_EXPORT BPatch_thread { friend class BPatch; friend class BPatch_image; friend class BPatch_function; diff --git a/dyninstAPI/h/BPatch_type.h b/dyninstAPI/h/BPatch_type.h index 699295c..80ab339 100644 --- a/dyninstAPI/h/BPatch_type.h +++ b/dyninstAPI/h/BPatch_type.h @@ -41,6 +41,8 @@ #ifndef _BPatch_type_h_ #define _BPatch_type_h_ + +#include "BPatch_dll.h" #include "BPatch_Vector.h" typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar, @@ -119,7 +121,7 @@ class BPatch_function; * A field can be an atomic type, i.e, int, char, or more complex like a * union or struct. */ -class BPatch_field { +class BPATCH_DLL_EXPORT BPatch_field { friend class BPatch_variableExpr; char *fieldname; @@ -165,7 +167,7 @@ public: // Define an instance of a Common block. Each subroutine can have its own // version of the common block. // -class BPatch_cblock { +class BPATCH_DLL_EXPORT BPatch_cblock { friend BPatch_type; private: @@ -180,7 +182,7 @@ public: BPatch_Vector *getFunctions() { return &functions; } }; -class BPatch_type { +class BPATCH_DLL_EXPORT BPatch_type { private: bool nullType; char *name; @@ -283,7 +285,7 @@ public: // It is desgined store information about a variable in a function. // Scope needs to be addressed in this class. -class BPatch_localVar{ +class BPATCH_DLL_EXPORT BPatch_localVar{ char * name; BPatch_type * type; int lineNum; -- 1.8.3.1