Skip to content

Commit

Permalink
Fix suppressed Windows linker errors
Browse files Browse the repository at this point in the history
Deriving QgsAttributes from QVector<QVariant> and then exporting the
whole QgsAttributes class also exports symbols of QVector<QVariant>.
This leads to linker issues with object files using QVector<QVariant>
if a library/executable links against qgis_core.

Just exporting the only function of QgsAttributes that is not inline is
sufficient and solves the linker errors.
  • Loading branch information
stefanuhrig authored and jef-n committed Jan 18, 2021
1 parent 15b647a commit 32e5ec0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/3d/CMakeLists.txt
Expand Up @@ -215,9 +215,6 @@ GENERATE_EXPORT_HEADER(
BASE_NAME 3D
EXPORT_FILE_NAME qgis_3d.h
)
if(MSVC)
set_target_properties(qgis_3d PROPERTIES LINK_FLAGS "/FORCE:MULTIPLE")
endif()

set(QGIS_3D_HDRS ${QGIS_3D_HDRS} ${CMAKE_CURRENT_BINARY_DIR}/qgis_3d.h)

Expand Down
3 changes: 0 additions & 3 deletions src/analysis/CMakeLists.txt
Expand Up @@ -456,9 +456,6 @@ GENERATE_EXPORT_HEADER(
BASE_NAME ANALYSIS
EXPORT_FILE_NAME qgis_analysis.h
)
if(MSVC)
set_target_properties(qgis_analysis PROPERTIES LINK_FLAGS "/FORCE:MULTIPLE")
endif()

set(QGIS_ANALYSIS_HDRS ${QGIS_ANALYSIS_HDRS} ${CMAKE_CURRENT_BINARY_DIR}/qgis_analysis.h)

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsattributes.h
Expand Up @@ -54,7 +54,7 @@ typedef QMap<int, QgsField> QgsFieldMap;
* \note QgsAttributes is implemented as a Python list of Python objects.
*/
#ifndef SIP_RUN
class CORE_EXPORT QgsAttributes : public QVector<QVariant>
class QgsAttributes : public QVector<QVariant>
{
public:

Expand Down Expand Up @@ -115,7 +115,7 @@ class CORE_EXPORT QgsAttributes : public QVector<QVariant>
* \note not available in Python bindings
* \since QGIS 3.0
*/
QgsAttributeMap toMap() const SIP_SKIP;
CORE_EXPORT QgsAttributeMap toMap() const SIP_SKIP;

inline bool operator!=( const QgsAttributes &v ) const { return !( *this == v ); }
};
Expand Down

0 comments on commit 32e5ec0

Please sign in to comment.