Skip to content

MultipleColumnsSelectedError lacks dllexport attribute #61

@SchaichAlonso

Description

@SchaichAlonso

Hi,

The Orm::Exceptions::MultipleColumnsSelectedError exception class is not marked for dllexport. If tinyorm is compiled with -fvisibility=hidden, the exception class will therefore not be visible outside of the tinyorm dll.

The tst_DatabaseConnection::scalar_MultipleColumnsSelectedError() unit test requires an instance of MultipleColumnsSelectedError to be thrown. As the exception class instanciated inside the dll doesn't export it's vtable through the dll interface, an equally named class outside the dll domain will be incompatible in terms of type deduction, and therefore the exception can not be caught on its own name:

...
FAIL!  : tst_DatabaseConnection::scalar_MultipleColumnsSelectedError(tinyorm_sqlite_tests) Expected an exception of type MultipleColumnsSelectedError to be thrown, but caught std::exception with message 2 columns were selected in DatabaseConnection::scalar(), select only one column with the scalar() method.
Loc: [/tmp/TinyORM-0.38.1/tests/auto/unit/orm/databaseconnection/tst_databaseconnection.cpp(871)]

The test passes if it is modified to validate an instance of the parent class (Orm::Exceptions::RuntimeError, which is exported) is thrown, or if Orm::Exceptions::MultipleColumnsSelectedError is exported by decorating it with TINYORM_EXPORT .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions