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

@@ -14,6 +14,7 @@
#include <IntImp_ComputeTangence.hxx>
#include <IntImp_ConstIsoparametric.hxx>
#include <Standard_OutOfRange.hxx>
static const IntImp_ConstIsoparametric staticChoixRef [4] = {
IntImp_UIsoparametricOnCaro1,
@@ -22,7 +23,11 @@ IntImp_UIsoparametricOnCaro2,
IntImp_VIsoparametricOnCaro2,
};
Standard_EXPORT const IntImp_ConstIsoparametric *ChoixRef = staticChoixRef ;
IntImp_ConstIsoparametric ChoixRef (Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if (theIndex < 0 || theIndex > 3, "ChoixRef() in " __FILE__)
return staticChoixRef[theIndex];
}
//=======================================================================
//function : IntImp_ComputeTangence
@@ -131,7 +136,10 @@ Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[],
Standard_Boolean triOk = Standard_False;
Standard_Real t;
IntImp_ConstIsoparametric ti;
for ( i=0;i<=3;i++) TabIso[i] = ChoixRef[i];
for ( i=0;i<=3;i++)
{
TabIso[i] = staticChoixRef[i];
}
do {
triOk = Standard_True;
for(i=1;i<=3;i++) {
@@ -168,7 +176,10 @@ Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[],
NormDuv[II] = NormDuv[j];
NormDuv[j] = Tampon;
}
for (j=0; j<=3;j++) TabIso[j]=ChoixRef[Irang[j]];
for (j=0; j<=3;j++)
{
TabIso[j] = staticChoixRef[Irang[j]];
}
#endif
}
return tangent;

View File

@@ -15,20 +15,9 @@
#include <gp_Vec.hxx>
#include <IntImp_ConstIsoparametric.hxx>
#if !defined(_WIN32) || defined(__ApproxInt_DLL) || defined(__IntImp_DLL) || defined(__IntWalk_DLL) || defined(__GeomInt_DLL) || defined(__IntPatch_DLL)
Standard_EXPORTEXTERN const IntImp_ConstIsoparametric *ChoixRef;
#else
Standard_IMPORT const IntImp_ConstIsoparametric *ChoixRef;
#endif
Standard_EXPORT IntImp_ConstIsoparametric ChoixRef (Standard_Integer theIndex);
Standard_EXPORT Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[],
const Standard_Real EpsUV[],
Standard_Real Tgduv[],
IntImp_ConstIsoparametric TabIso[]);

View File

@@ -25,9 +25,6 @@
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
//Standard_IMPORT extern IntImp_ConstIsoparametric *ChoixRef;
IntImp_Int2S::IntImp_Int2S(const ThePSurface& surf1,
const ThePSurface& surf2,
const Standard_Real TolTangency ) :
@@ -131,7 +128,7 @@ IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Par
TColStd_Array1OfReal Duv (DuvBuf[0], 1, 4);
Standard_Real UVd[4],UVf[4];
IntImp_ConstIsoparametric ChoixIso[4];
IntImp_ConstIsoparametric BestChoix=ChoixRef[0];
IntImp_ConstIsoparametric BestChoix = ChoixRef(0);
const ThePSurface& Caro1 = myZerParFunc.AuxillarSurface1();
const ThePSurface& Caro2 = myZerParFunc.AuxillarSurface2();
@@ -220,7 +217,7 @@ IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Par
}
else return BestChoix; // on a gagne
empty = Standard_True;
BestChoix = ChoixRef[Iiso]; //en attendant
BestChoix = ChoixRef(Iiso); //en attendant
BestChoix = Perform(Duv,Rsnld,BestChoix);
if (!empty) { // verification si l on ne deborde pas sur le carreau
// reciproque
@@ -247,7 +244,7 @@ IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Par
if(Nc == 4)
Nc = 0;
BestChoix = ChoixRef[Nc]; //en attendant
BestChoix = ChoixRef(Nc); //en attendant
BestChoix = Perform(Duv,Rsnld,BestChoix);
}
}