--- /dev/null
+ CMakeLists.txt | 64 +-----------------
+ cmake/cmake_modules/FindOpenCasCade.cmake | 105 ++++++++++++++++++++++++++++++
+ 2 files changed, 108 insertions(+), 61 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0a05ebb1..d55dc03c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -349,67 +349,9 @@ install(TARGETS netgen_mpi netgen_metis ${NG_INSTALL_DIR})
+
+ #######################################################################
+ if (USE_OCC)
+- find_package(OpenCascade NAMES OpenCASCADE opencascade REQUIRED CMAKE_FIND_ROOT_PATH_BOTH)
+- add_definitions(-DOCCGEOMETRY)
+- set(OCC_LIBRARIES
+- TKBO
+- TKBRep
+- TKBool
+- TKCAF
+- TKCDF
+- TKFillet
+- TKG2d
+- TKG3d
+- TKGeomAlgo
+- TKGeomBase
+- TKHLR
+- TKIGES
+- TKLCAF
+- TKMath
+- TKMesh
+- TKOffset
+- TKPrim
+- TKSTEP
+- TKSTEP209
+- TKSTEPAttr
+- TKSTEPBase
+- TKSTL
+- TKService
+- TKShHealing
+- TKTopAlgo
+- TKV3d
+- TKVCAF
+- TKXCAF
+- TKXDEIGES
+- TKXDESTEP
+- TKXSBase
+- TKernel
+- )
+- include_directories(${OpenCASCADE_INCLUDE_DIR})
+- if(NOT OpenCASCADE_BUILD_SHARED_LIBS)
+- if(OpenCASCADE_WITH_FREETYPE)
+- find_library( FREETYPE NAMES freetype HINTS ${OpenCASCADE_INSTALL_PREFIX}/lib)
+- list(APPEND OCC_LIBRARIES ${FREETYPE})
+- if(UNIX AND NOT APPLE)
+- find_package(Fontconfig REQUIRED)
+- list(APPEND OCC_LIBRARIES ${Fontconfig_LIBRARIES})
+- endif()
+- endif(OpenCASCADE_WITH_FREETYPE)
+- if(UNIX AND NOT APPLE)
+- set(THREADS_PREFER_PTHREAD_FLAG ON)
+- find_package(Threads REQUIRED)
+- list(APPEND OCC_LIBRARIES Threads::Threads)
+- list(PREPEND OCC_LIBRARIES -Wl,--start-group)
+- list(APPEND OCC_LIBRARIES -Wl,--end-group)
+- endif()
+- if(WIN32)
+- list(APPEND OCC_LIBRARIES Ws2_32.lib)
+- endif()
+- endif()
+- message(STATUS "OCC DIRS ${OpenCASCADE_INCLUDE_DIR}")
+- if(WIN32 AND USE_GUI)
+- target_link_libraries(nggui PRIVATE ${OCC_LIBRARIES})
+- endif(WIN32 AND USE_GUI)
++ find_package(OpenCasCade REQUIRED)
++ add_definitions(-DOCCGEOMETRY -D_OCC64)
++ include_directories(${OCC_INCLUDE_DIR})
+ endif (USE_OCC)
+
+ #######################################################################
+diff --git a/cmake/cmake_modules/FindOpenCasCade.cmake b/cmake/cmake_modules/FindOpenCasCade.cmake
+new file mode 100644
+index 00000000..870e8ed5
+--- /dev/null
++++ b/cmake/cmake_modules/FindOpenCasCade.cmake
+@@ -0,0 +1,105 @@
++# Try to find OCC
++# Once done this will define
++#
++# OCC_FOUND - system has OCC - OpenCASCADE
++# OCC_INCLUDE_DIR - where the OCC include directory can be found
++# OCC_LIBRARY_DIR - where the OCC library directory can be found
++# OCC_LIBRARIES - Link this to use OCC
++
++if(WIN32)
++ find_path(OCC_INCLUDE_DIR Standard_Version.hxx PATH_SUFFIXES inc ../inc)
++ find_library(OCC_LIBRARY TKernel)
++else(WIN32)
++ find_path(OCC_INCLUDE_DIR Standard_Version.hxx
++ /usr/include/opencascade
++ /usr/local/include/opencascade
++ /usr/include/oce
++ /usr/local/include/oce
++ /opt/opencascade/include
++ /opt/opencascade/inc
++ )
++ find_library(OCC_LIBRARY TKernel
++ /usr/lib
++ /usr/local/lib
++ /opt/opencascade/lib
++ )
++endif(WIN32)
++
++if(OCC_LIBRARY AND NOT OCC_LIBRARY_DIR)
++ get_filename_component(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
++endif(OCC_LIBRARY AND NOT OCC_LIBRARY_DIR)
++
++if(OCC_INCLUDE_DIR)
++ file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
++ REGEX "#define OCC_VERSION_MAJOR.*"
++ )
++ string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
++ file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
++ REGEX "#define OCC_VERSION_MINOR.*"
++ )
++ string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
++ file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
++ REGEX "#define OCC_VERSION_MAINTENANCE.*"
++ )
++ string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
++
++ set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
++endif(OCC_INCLUDE_DIR)
++
++
++set(OCC_LIBRARY_NAMES
++ TKBO
++ TKBool
++ TKBRep
++ TKCAF
++ TKCDF
++ TKernel
++ TKG2d
++ TKG3d
++ TKGeomAlgo
++ TKGeomBase
++ TKHLR
++ TKIGES
++ TKLCAF
++ TKMath
++ TKMesh
++ TKOffset
++ TKPrim
++ TKService
++ TKShHealing
++ TKSTEP
++ TKSTEP209
++ TKSTEPAttr
++ TKSTEPBase
++ TKSTL
++ TKTopAlgo
++ TKV3d
++ TKXCAF
++ TKXDEIGES
++ TKXDESTEP
++ TKXSBase
++)
++
++if(OCC_LINK_FREETYPE)
++ set(OCC_LIBRARY_NAMES ${OCC_LIBRARY_NAMES} freetype)
++endif(OCC_LINK_FREETYPE)
++
++if(OCC_VERSION_STRING VERSION_GREATER_EQUAL "7.3.0")
++ set(OCC_LIBRARY_NAMES ${OCC_LIBRARY_NAMES} TKVCAF)
++endif()
++
++foreach( libname ${OCC_LIBRARY_NAMES} )
++ find_library( ${libname} ${libname} ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH)
++ set(OCC_LIBRARIES ${OCC_LIBRARIES} ${${libname}})
++endforeach()
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING ${OCC_LIBRARIY_NAMES})
++
++if(OCC_FOUND)
++ message(STATUS "-- Found OpenCASCADE version: ${OCC_VERSION_STRING}")
++ message(STATUS "-- OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
++ message(STATUS "-- OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
++ message(STATUS "-- OpenCASCADE shared libraries :\n ${OCC_LIBRARIES}")
++endif(OCC_FOUND)
++
--- /dev/null
+ libsrc/core/version.hpp | 7 ++++++-
+ libsrc/meshing/meshclass.cpp | 6 +++---
+ libsrc/occ/occgenmesh.cpp | 13 +++++++------
+ libsrc/stlgeom/stlgeom.hpp | 2 +-
+ libsrc/stlgeom/stltopology.hpp | 2 +-
+ nglib/nglib.cpp | 2 +-
+ 6 files changed, 19 insertions(+), 13 deletions(-)
+
+diff --git a/libsrc/core/version.hpp b/libsrc/core/version.hpp
+index 3048ce5b..81524b58 100644
+--- a/libsrc/core/version.hpp
++++ b/libsrc/core/version.hpp
+@@ -41,7 +41,12 @@ namespace ngcore
+ if(!vstring.empty())
+ {
+ dot = vstring.find('-');
+- patch = std::stoi(vstring.substr(0,dot));
++ try {
++ patch = std::stoi(vstring.substr(0,dot));
++ }
++ catch (const std::exception& e) {
++ patch = 0;
++ }
+ if(dot == size_t(-1)) vstring = "";
+ else vstring = vstring.substr(dot+1, vstring.size()-dot-1);
+ if(!vstring.empty())
+diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp
+index c89064cb..a23b8889 100644
+--- a/libsrc/meshing/meshclass.cpp
++++ b/libsrc/meshing/meshclass.cpp
+@@ -281,8 +281,8 @@ namespace netgen
+ for(int i = 0; i < userdata_double.Size(); i++)
+ delete userdata_double[i];
+
+- for (int i = 0; i < bcnames.Size(); i++ )
+- delete bcnames[i];
++ // for (int i = 0; i < bcnames.Size(); i++ )
++ // delete bcnames[i];
+
+ for (int i = 0; i < cd2names.Size(); i++)
+ delete cd2names[i];
+@@ -7087,7 +7087,7 @@ namespace netgen
+ bcnames[i] = new string("default");
+ }
+
+- if ( bcnames[bcnr] ) delete bcnames[bcnr];
++ //if ( bcnames[bcnr] ) delete bcnames[bcnr];
+ bcnames[bcnr] = new string ( abcname );
+
+ for (auto & fd : facedecoding)
+diff --git a/libsrc/occ/occgenmesh.cpp b/libsrc/occ/occgenmesh.cpp
+index e0164177..884d6d1d 100644
+--- a/libsrc/occ/occgenmesh.cpp
++++ b/libsrc/occ/occgenmesh.cpp
+@@ -7,6 +7,7 @@
+ #include "occ_face.hpp"
+ #include "occmeshsurf.hpp"
+
++#include <BRepTools.hxx>
+ #include <BRepAdaptor_Curve.hxx>
+ #include <BRepGProp.hxx>
+ #include <BRepLProp_CLProps.hxx>
+@@ -653,13 +654,13 @@ namespace netgen
+
+ for (int k = 1; k <=3; k++)
+ {
+- // int n = triangulation->Triangles()(j)(k);
+- // p[k-1] = triangulation->Nodes()(n).Transformed(loc);
+- // par[k-1] = triangulation->UVNodes()(n);
++ int n = triangulation->Triangles()(j)(k);
++ p[k-1] = triangulation->Nodes()(n).Transformed(loc);
++ par[k-1] = triangulation->UVNodes()(n);
+ // fix for OCC7.6.0-dev
+- int n = triangulation->Triangle(j)(k);
+- p[k-1] = triangulation->Node(n).Transformed(loc);
+- par[k-1] = triangulation->UVNode(n);
++ //int n = triangulation->Triangle(j)(k);
++ //p[k-1] = triangulation->Node(n).Transformed(loc);
++ //par[k-1] = triangulation->UVNode(n);
+ }
+
+ //double maxside = 0;
+diff --git a/libsrc/stlgeom/stlgeom.hpp b/libsrc/stlgeom/stlgeom.hpp
+index 8cc5739e..46bad1dc 100644
+--- a/libsrc/stlgeom/stlgeom.hpp
++++ b/libsrc/stlgeom/stlgeom.hpp
+@@ -68,7 +68,7 @@ namespace netgen
+ void Restore ();
+
+ void SetSize(int /* size */) { };
+- void Clear() { };
++ DLL_HEADER void Clear() { };
+ int Size() const { return geom.GetNTE(); }
+ const STLTopEdge & Get(int i) const { return geom.GetTopEdge(i); }
+ STLTopEdge & Elem(int i) { return geom.GetTopEdge(i); }
+diff --git a/libsrc/stlgeom/stltopology.hpp b/libsrc/stlgeom/stltopology.hpp
+index 34c3c801..c5c868c4 100644
+--- a/libsrc/stlgeom/stltopology.hpp
++++ b/libsrc/stlgeom/stltopology.hpp
+@@ -350,7 +350,7 @@ public:
+ int GetNP() const { return points.Size(); }
+ int AddPoint(const Point<3> & p) { points.Append(p); return points.Size(); }
+ const Point<3> & GetPoint(STLPointId nr) const { return points[nr]; } // .Get(nr); }
+- int GetPointNum (const Point<3> & p);
++ DLL_HEADER int GetPointNum (const Point<3> & p);
+ void SetPoint(STLPointId nr, const Point<3> & p) { points[nr] = p; } // { points.Elem(nr) = p; }
+ auto & GetPoints() const { return points; }
+
+diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp
+index c72e067b..2d548ca6 100644
+--- a/nglib/nglib.cpp
++++ b/nglib/nglib.cpp
+@@ -542,7 +542,7 @@ namespace nglib
+
+
+ NgArray<STLReadTriangle> readtrias; //only before initstlgeometry
+- NgArray<Point<3> > readedges; //only before init stlgeometry
++ DLL_HEADER NgArray<Point<3> > readedges; //only before init stlgeometry
+
+ // loads geometry from STL file
+ NGLIB_API Ng_STL_Geometry * Ng_STL_LoadGeometry (const char * filename, int binary)