1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0022651: Impossible to build OCC as static library due to using Standard_EXPORT instead of Standard_API

All library-specific macros for defining export / import properties of symbols on Windows (like Standard_API, __Draw_API, _math_API etc.) are eliminated.
Common macro Standard_EXPORT is used in all places where it is necessary.

New macro OCCT_STATIC_BUILD is defined for disabling Standard_EXPORT, to be used instead of HAVE_NO_DLL, though the latter is still supported as well (for compatibility).

To allow building OCCT in static mode on Windows after these changes:
- Files OSD_WNT_1.hxx and OSD_WNT_BREAK.hxx are removed; useful declarations are moved to OSD_WNT.hxx
- In the class IVtkVTK_ShapeData, static fields ARRNAME_MESH_TYPES and ARRNAME_SUBSHAPE_IDS are converted to static inline functions
- Global array ChoixRef defined in IntImp_ComputeTangence.cxx is converted to static function returning element of the array by index
- Unused class Quantity_Convert is removed (it had static field accessed by inline method)
- Struct Approx_Data defined in the same way in BRepApprox_Approx.hxx and GeomInt_WLApprox.hxx is made private member of these classes to avoid name clash
- Some C++ files producing no object code are removed
- In NCollection_EBTree.hxx and StdLPersistent_Collectio.hxx, definition of template virtual method is moved to class definition to avoid MSVC linker warnings on unused symbols
This commit is contained in:
abv
2018-03-15 13:07:48 +03:00
parent 8662560e2c
commit 68df847802
86 changed files with 465 additions and 1367 deletions

View File

@@ -32,21 +32,6 @@ extern void Draw_Appli(int argc, char** argv,
const FDraw_InitAppli Draw_InitAppli);
#endif
#if defined(_WIN32) && !defined(HAVE_NO_DLL)
#ifndef __Draw_API
# ifdef __Draw_DLL
# define __Draw_API __declspec ( dllexport )
# else
# define __Draw_API __declspec ( dllimport )
# endif
#endif
#else
# define __Draw_API
#endif
#ifndef _WIN32
extern Draw_Viewer dout;
extern Standard_Boolean Draw_Batch;
@@ -56,7 +41,6 @@ class Draw_SaveAndRestore {
public :
// __Draw_API Draw_SaveAndRestore
Standard_EXPORT Draw_SaveAndRestore
(const char* name,
Standard_Boolean (*test)(const Handle(Draw_Drawable3D)&),

View File

@@ -31,16 +31,8 @@
#ifdef _WIN32
#include <windows.h>
#if !defined(__Draw_API) && !defined(HAVE_NO_DLL)
# ifdef __Draw_DLL
# define __Draw_API __declspec( dllexport )
# else
# define __Draw_API /*__declspec( dllimport )*/
# endif
#endif
#else
# define __Draw_API
#endif
const Standard_Integer MAXVIEW = 30;
class Draw_View;
@@ -48,72 +40,72 @@ class Draw_View;
class Draw_Viewer {
public :
__Draw_API Draw_Viewer ();
__Draw_API Standard_Boolean DefineColor (const Standard_Integer i,
Standard_EXPORT Draw_Viewer ();
Standard_EXPORT Standard_Boolean DefineColor (const Standard_Integer i,
const char* colname);
__Draw_API void MakeView (const Standard_Integer id,
Standard_EXPORT void MakeView (const Standard_Integer id,
const char* typ,
const Standard_Integer X, const Standard_Integer Y,
const Standard_Integer W, const Standard_Integer H);
// build a view on a given window
#ifdef _WIN32
__Draw_API void MakeView (const Standard_Integer id,
Standard_EXPORT void MakeView (const Standard_Integer id,
const char* typ,
const Standard_Integer X, const Standard_Integer Y,
const Standard_Integer W, const Standard_Integer H,
HWND win,
const Standard_Boolean useBuffer = Standard_False);
#endif
__Draw_API void MakeView (const Standard_Integer id,
Standard_EXPORT void MakeView (const Standard_Integer id,
const char* typ,
const char* window);
__Draw_API void SetTitle (const Standard_Integer id,
Standard_EXPORT void SetTitle (const Standard_Integer id,
const char* name);
__Draw_API void ResetView (const Standard_Integer id);
__Draw_API void SetZoom (const Standard_Integer id,
Standard_EXPORT void ResetView (const Standard_Integer id);
Standard_EXPORT void SetZoom (const Standard_Integer id,
const Standard_Real z);
__Draw_API void RotateView (const Standard_Integer id,
Standard_EXPORT void RotateView (const Standard_Integer id,
const gp_Dir2d&,
const Standard_Real);
__Draw_API void RotateView (const Standard_Integer id,
Standard_EXPORT void RotateView (const Standard_Integer id,
const gp_Pnt&,
const gp_Dir&,
const Standard_Real);
__Draw_API void SetFocal (const Standard_Integer id,
Standard_EXPORT void SetFocal (const Standard_Integer id,
const Standard_Real FocalDist);
__Draw_API char* GetType (const Standard_Integer id) const;
__Draw_API Standard_Real Zoom (const Standard_Integer id) const;
__Draw_API Standard_Real Focal (const Standard_Integer id) const;
__Draw_API void SetTrsf (const Standard_Integer id,
Standard_EXPORT char* GetType (const Standard_Integer id) const;
Standard_EXPORT Standard_Real Zoom (const Standard_Integer id) const;
Standard_EXPORT Standard_Real Focal (const Standard_Integer id) const;
Standard_EXPORT void SetTrsf (const Standard_Integer id,
gp_Trsf& T);
__Draw_API void GetTrsf (const Standard_Integer id,
Standard_EXPORT void GetTrsf (const Standard_Integer id,
gp_Trsf& T) const;
__Draw_API void GetPosSize (const Standard_Integer id,
Standard_EXPORT void GetPosSize (const Standard_Integer id,
Standard_Integer& X, Standard_Integer& Y,
Standard_Integer& W, Standard_Integer& H);
__Draw_API Standard_Boolean Is3D (const Standard_Integer id) const;
__Draw_API void GetFrame (const Standard_Integer id,
Standard_EXPORT Standard_Boolean Is3D (const Standard_Integer id) const;
Standard_EXPORT void GetFrame (const Standard_Integer id,
Standard_Integer& xmin, Standard_Integer& ymin,
Standard_Integer& xmax, Standard_Integer& ymax);
__Draw_API void FitView (const Standard_Integer id, const Standard_Integer frame);
__Draw_API void PanView (const Standard_Integer id,
Standard_EXPORT void FitView (const Standard_Integer id, const Standard_Integer frame);
Standard_EXPORT void PanView (const Standard_Integer id,
const Standard_Integer DX, const Standard_Integer DY);
__Draw_API void SetPan (const Standard_Integer id,
Standard_EXPORT void SetPan (const Standard_Integer id,
const Standard_Integer DX, const Standard_Integer DY);
__Draw_API void GetPan (const Standard_Integer id,
Standard_EXPORT void GetPan (const Standard_Integer id,
Standard_Integer& DX, Standard_Integer& DY);
__Draw_API Standard_Boolean HasView (const Standard_Integer id) const;
__Draw_API void DisplayView (const Standard_Integer id) const;
__Draw_API void HideView (const Standard_Integer id) const;
__Draw_API void ClearView (const Standard_Integer id) const;
__Draw_API void RemoveView (const Standard_Integer id) ;
__Draw_API void RepaintView (const Standard_Integer id) const;
Standard_EXPORT Standard_Boolean HasView (const Standard_Integer id) const;
Standard_EXPORT void DisplayView (const Standard_Integer id) const;
Standard_EXPORT void HideView (const Standard_Integer id) const;
Standard_EXPORT void ClearView (const Standard_Integer id) const;
Standard_EXPORT void RemoveView (const Standard_Integer id) ;
Standard_EXPORT void RepaintView (const Standard_Integer id) const;
#ifdef _WIN32
__Draw_API void ResizeView (const Standard_Integer id) const;
__Draw_API void UpdateView (const Standard_Integer id, const Standard_Boolean forced = Standard_False) const;
Standard_EXPORT void ResizeView (const Standard_Integer id) const;
Standard_EXPORT void UpdateView (const Standard_Integer id, const Standard_Boolean forced = Standard_False) const;
#endif
__Draw_API void ConfigView (const Standard_Integer id) const;
__Draw_API void PostScriptView (const Standard_Integer id,
Standard_EXPORT void ConfigView (const Standard_Integer id) const;
Standard_EXPORT void PostScriptView (const Standard_Integer id,
const Standard_Integer VXmin,
const Standard_Integer VYmin,
const Standard_Integer VXmax,
@@ -123,48 +115,48 @@ class Draw_Viewer {
const Standard_Integer PXmax,
const Standard_Integer PYmax,
ostream& sortie) const;
__Draw_API void PostColor(const Standard_Integer icol,
Standard_EXPORT void PostColor(const Standard_Integer icol,
const Standard_Integer width,
const Standard_Real gray);
__Draw_API Standard_Boolean SaveView(const Standard_Integer id, const char* filename);
__Draw_API void RepaintAll () const;
__Draw_API void Repaint2D () const;
__Draw_API void Repaint3D () const;
__Draw_API void DeleteView (const Standard_Integer id);
__Draw_API void Clear ();
__Draw_API void Clear2D ();
__Draw_API void Clear3D ();
__Draw_API void Flush ();
Standard_EXPORT Standard_Boolean SaveView(const Standard_Integer id, const char* filename);
Standard_EXPORT void RepaintAll () const;
Standard_EXPORT void Repaint2D () const;
Standard_EXPORT void Repaint3D () const;
Standard_EXPORT void DeleteView (const Standard_Integer id);
Standard_EXPORT void Clear ();
Standard_EXPORT void Clear2D ();
Standard_EXPORT void Clear3D ();
Standard_EXPORT void Flush ();
__Draw_API void DrawOnView (const Standard_Integer id,
Standard_EXPORT void DrawOnView (const Standard_Integer id,
const Handle(Draw_Drawable3D)& D) const;
__Draw_API void HighlightOnView (const Standard_Integer id,
Standard_EXPORT void HighlightOnView (const Standard_Integer id,
const Handle(Draw_Drawable3D)& D,
const Draw_ColorKind C = Draw_blanc) const;
__Draw_API void AddDrawable (const Handle(Draw_Drawable3D)& D);
__Draw_API void RemoveDrawable (const Handle(Draw_Drawable3D)& D);
__Draw_API Draw_Display MakeDisplay (const Standard_Integer id) const;
Standard_EXPORT void AddDrawable (const Handle(Draw_Drawable3D)& D);
Standard_EXPORT void RemoveDrawable (const Handle(Draw_Drawable3D)& D);
Standard_EXPORT Draw_Display MakeDisplay (const Standard_Integer id) const;
__Draw_API void Select (Standard_Integer& id, // View, -1 if none
Standard_EXPORT void Select (Standard_Integer& id, // View, -1 if none
Standard_Integer& X, // Pick coordinates
Standard_Integer& Y,
Standard_Integer& Button, // Button pressed, 0 if none
Standard_Boolean waitclick = Standard_True
);
__Draw_API Standard_Integer Pick(const Standard_Integer id, // returns the index (or 0)
Standard_EXPORT Standard_Integer Pick(const Standard_Integer id, // returns the index (or 0)
const Standard_Integer X,
const Standard_Integer Y,
const Standard_Integer Prec,
Handle(Draw_Drawable3D)& D,
const Standard_Integer First = 0) const; // search after this drawable
__Draw_API void LastPick(gp_Pnt& P1, gp_Pnt& P2, Standard_Real& Param);
Standard_EXPORT void LastPick(gp_Pnt& P1, gp_Pnt& P2, Standard_Real& Param);
// returns the extremities and parameter of the last picked segment
__Draw_API ~Draw_Viewer();
__Draw_API Draw_Viewer& operator<<(const Handle(Draw_Drawable3D)&);
__Draw_API const Draw_SequenceOfDrawable3D& GetDrawables();
Standard_EXPORT ~Draw_Viewer();
Standard_EXPORT Draw_Viewer& operator<<(const Handle(Draw_Drawable3D)&);
Standard_EXPORT const Draw_SequenceOfDrawable3D& GetDrawables();
private :

View File

@@ -362,14 +362,6 @@ void GetNextEvent (Standard_Boolean theWait,
#define DRAWTITLE L"Draw View"
#define MAXCOLOR 15
#if !defined(__Draw_API) && !defined(HAVE_NO_DLL)
# ifdef __Draw_DLL
# define __Draw_API __declspec( dllexport )
# else
# define __Draw_API __declspec( dllimport )
# endif
#endif
// definition de la classe Segment
class DrawWindow;
@@ -421,86 +413,86 @@ public:
*/
Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB);
__Draw_API DrawWindow();
__Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
Standard_EXPORT DrawWindow();
Standard_EXPORT DrawWindow(const char*, Standard_Integer, Standard_Integer,
Standard_Integer, Standard_Integer);
__Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
Standard_EXPORT DrawWindow(const char*, Standard_Integer, Standard_Integer,
Standard_Integer, Standard_Integer, HWND);
//destructeur
__Draw_API virtual ~DrawWindow();
Standard_EXPORT virtual ~DrawWindow();
//methods
public:
__Draw_API void Init(Standard_Integer, Standard_Integer,
Standard_EXPORT void Init(Standard_Integer, Standard_Integer,
Standard_Integer, Standard_Integer);
__Draw_API void SetUseBuffer(Standard_Boolean);
Standard_EXPORT void SetUseBuffer(Standard_Boolean);
// Turns on/off usage of off-screen image buffer (can be used for redrawing optimization)
Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
// Returns Standard_True if off-screen image buffer is being used
//taille et position
__Draw_API void SetPosition (Standard_Integer,Standard_Integer);
__Draw_API void SetDimension(Standard_Integer,Standard_Integer);
__Draw_API void GetPosition (Standard_Integer&,Standard_Integer&);
__Draw_API Standard_Integer HeightWin() const;
__Draw_API Standard_Integer WidthWin() const;
Standard_EXPORT void SetPosition (Standard_Integer,Standard_Integer);
Standard_EXPORT void SetDimension(Standard_Integer,Standard_Integer);
Standard_EXPORT void GetPosition (Standard_Integer&,Standard_Integer&);
Standard_EXPORT Standard_Integer HeightWin() const;
Standard_EXPORT Standard_Integer WidthWin() const;
//Title
__Draw_API void SetTitle (const TCollection_AsciiString& );
__Draw_API TCollection_AsciiString GetTitle() const;
Standard_EXPORT void SetTitle (const TCollection_AsciiString& );
Standard_EXPORT TCollection_AsciiString GetTitle() const;
//Affichage
//! Return true if window is displayed on the screen.
bool IsMapped() const;
__Draw_API void DisplayWindow();
__Draw_API void Hide();
__Draw_API void Destroy();
__Draw_API void Clear();
Standard_EXPORT void DisplayWindow();
Standard_EXPORT void Hide();
Standard_EXPORT void Destroy();
Standard_EXPORT void Clear();
static void Flush() {} ;
// save snapshot
__Draw_API Standard_Boolean Save(const char* theFileName) const;
Standard_EXPORT Standard_Boolean Save(const char* theFileName) const;
//Dessin
__Draw_API void DrawString(int,int,char*);
__Draw_API void DrawSegments(Segment*,int);
Standard_EXPORT void DrawString(int,int,char*);
Standard_EXPORT void DrawSegments(Segment*,int);
__Draw_API void InitBuffer();
Standard_EXPORT void InitBuffer();
// Initializes off-screen image buffer according to current window size
__Draw_API void Redraw();
Standard_EXPORT void Redraw();
// Copies an image from memory buffer to screen
//Couleur
__Draw_API void SetColor(Standard_Integer);
__Draw_API void SetMode(int);
__Draw_API static Standard_Boolean DefineColor ( const Standard_Integer,const char*);
Standard_EXPORT void SetColor(Standard_Integer);
Standard_EXPORT void SetMode(int);
Standard_EXPORT static Standard_Boolean DefineColor ( const Standard_Integer,const char*);
//Gestion des Messages
__Draw_API virtual void WExpose ();
__Draw_API virtual void WButtonPress(const Standard_Integer,const Standard_Integer,
Standard_EXPORT virtual void WExpose ();
Standard_EXPORT virtual void WButtonPress(const Standard_Integer,const Standard_Integer,
const Standard_Integer&);
__Draw_API virtual void WButtonRelease(const Standard_Integer,const Standard_Integer,
Standard_EXPORT virtual void WButtonRelease(const Standard_Integer,const Standard_Integer,
const Standard_Integer&);
__Draw_API virtual void WMotionNotify(const Standard_Integer,const Standard_Integer);
__Draw_API virtual void WConfigureNotify(const Standard_Integer,const Standard_Integer,
Standard_EXPORT virtual void WMotionNotify(const Standard_Integer,const Standard_Integer);
Standard_EXPORT virtual void WConfigureNotify(const Standard_Integer,const Standard_Integer,
const Standard_Integer,const Standard_Integer);
__Draw_API virtual void WUnmapNotify();
Standard_EXPORT virtual void WUnmapNotify();
//Gestion souris
__Draw_API static void SelectWait (HANDLE&,int&,int&,int&);
__Draw_API static void SelectNoWait (HANDLE&,int&,int&,int&);
Standard_EXPORT static void SelectWait (HANDLE&,int&,int&,int&);
Standard_EXPORT static void SelectNoWait (HANDLE&,int&,int&,int&);
// Procedure de fenetre
__Draw_API static LRESULT APIENTRY DrawProc (HWND,UINT,WPARAM,LPARAM);
Standard_EXPORT static LRESULT APIENTRY DrawProc (HWND,UINT,WPARAM,LPARAM);
private:
__Draw_API static HWND CreateDrawWindow(HWND,int);
__Draw_API HDC GetMemDC(HDC);
__Draw_API void ReleaseMemDC(HDC);
Standard_EXPORT static HWND CreateDrawWindow(HWND,int);
Standard_EXPORT HDC GetMemDC(HDC);
Standard_EXPORT void ReleaseMemDC(HDC);
//atributs
public:
@@ -526,9 +518,9 @@ typedef enum {
// PROCEDURE DE DRAW WINDOW
__Draw_API Standard_Boolean Init_Appli(HINSTANCE,HINSTANCE,int,HWND&);
__Draw_API void Run_Appli(HWND);
__Draw_API void Destroy_Appli(HINSTANCE);
Standard_EXPORT Standard_Boolean Init_Appli(HINSTANCE,HINSTANCE,int,HWND&);
Standard_EXPORT void Run_Appli(HWND);
Standard_EXPORT void Destroy_Appli(HINSTANCE);
#endif