Skip to content

dll-export/import of sc_string_view exports symbols that should not be exported. #113

@jknvidia

Description

@jknvidia

Hello,

In sc_string_view.h, the class sc_string_view is declared as:

class SC_API sc_string_view
: public std::string_view
{
...
}

As a result, when systemc is built as a DLL on windows (ie. SC_API == __declspec(dllexport)), the DLL exports the symbols of std::string_view.
This makes systemc.dll unusable in a project that contains:

  1. A.cpp file that does not #include but uses std::string_view

  2. B.cpp file that uses SystemC stuff

Such project will not be able to link against systemc.dll. This is because A.obj will contain local symbols of std::string_view, B.obj will refer to imported symbols of std::string_view. The linker will complain on multiply defined symbols.

Since all members of sc_string_view are inline, the solution for the issue seems to be just removing the SC_API modifier from the declaration.

--Jacob

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions