unresolved external symbol stx::v1::begin_panic
melak47 opened this issue · 3 comments
Describe the bug
When building the library with STX_BUILD_SHARED on MSVC (VS2019 16.7.3), trying to use it leads to a linker error:
error LNK2019: unresolved external symbol "void __cdecl stx::v1::begin_panic(
class std::basic_string_view<char,struct std::char_traits<char> > const &,
class stx::v1::ReportPayload const &,
struct stx::v1::SourceLocation const &)"
(?begin_panic@v1@stx@@YAXAEBV?$basic_string_view@DU?$char_traits@D@std@@@std@@AEBVReportPayload@12@AEBUSourceLocation@12@@Z)
referenced in function "void __cdecl stx::v1::panic<struct io::Error>(
class std::basic_string_view<char,struct std::char_traits<char> > const &,
struct io::Error const &,
struct stx::v1::SourceLocation const &)"
(??$panic@UError@io@@@v1@stx@@YAXAEBV?$basic_string_view@DU?$char_traits@D@std@@@std@@AEBUError@io@@AEBUSourceLocation@01@@Z)
The begin_panic
function is called from the panic
function template, which gets instantiated in user-code,
so I think begin_panic
would have to be conditionally marked STX_EXPORT as well.
Expected behavior
If using the library as a DLL on windows is a supported scenario, it should work.
Desktop:
- OS: Windows 10
- Version 19041
I think there is a confusion that STX is meant to be used as a shared library. Though that wasn't the primary intention. The option is intended so that the panic behaviour of dynamic libraries using it can be customized.
But yeah, that'd be a great add. Thanks for this!
Merged!
I think there is a confusion that STX is meant to be used as a shared library.
It seemed to be a supported option to use STX as a shared library (STX_BUILD_SHARED
).