Skip to content

Conversation

@jeromehaxhiaj-qti
Copy link
Contributor

@jeromehaxhiaj-qti jeromehaxhiaj-qti commented Sep 11, 2025

Windows DLLs can't contain unresolved symbols. Therefore systemc,
when built with MSYS2, is split in two libraries: libsystemc-.dll
without unresolved symbols and libsystemc.a with unresolved symbols.

Currently, cmake target systemc (exposing libsystemc.a) is aliased as SystemC::systemc

This leads to a situation where projects that depend SystemC::systemc
would link only against the systemc.a and drop the dll.

This commit introduces the interface target library systemc_if,
which links against systemc dll and static and is aliased as SystemC::systemc.

To insure backward compatiblity, this mechanism is enabled only
when systemc is built as a shared library

This commits reworks the sections that merges
libsystemc.a and libsystemc-VER.dll.a

This patch removes conditional type for os.setf(), which was failing on
msys2 llvm environment and replaces it by auto type.

Signed-off-by: Jerome Haxhiaj <[email protected]>
@jeromehaxhiaj-qti
Copy link
Contributor Author

This pull-requests depends on #127

Windows DLLs can't contain unresolved symbols. Therefore systemc,
when built with MSYS2, is split in two libraries: libsystemc-<version>.dll
without unresolved symbols and libsystemc.a with unresolved symbols.

Currently, cmake target systemc (exposing libsystemc.a) is aliased as SystemC::systemc

This leads to a situation where projects that depend SystemC::systemc
would link only against the systemc.a and drop the dll.

This commit introduces the interface target library `systemc_if`,
which links against systemc dll and static and is aliased as SystemC::systemc.

To insure backward compatiblity, this mechanism is enabled only
when systemc is built as a shared library

This commits reworks the sections that merges
libsystemc.a and libsystemc-<version>.dll.a
@jeromehaxhiaj-qti jeromehaxhiaj-qti changed the title msys: Fix DLL dependency linkage Windows: Refactor DLL creation on Cygwin/MinGW env Sep 18, 2025
@barnasc
Copy link
Contributor

barnasc commented Oct 29, 2025

Tested SystemC DLL creation and usage successfully on Win11, using CMake 3.31.1 and MSVC compiler 16.11 ("Visual Studio 16 2019"). My recommendation is to merge

Copy link
Contributor

@maehne maehne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed changes make sense to me. However, is the generated library name really libsystemc-.dll on your platform? According to the CMakeLists.txt, the dash should be followed by the SystemC language version extracted from sc_ver.h.

IMHO, the changes to sc_signed.cpp and sc_unsigned.cpp are not topical, but a welcome clean up.

@jeromehaxhiaj-qti
Copy link
Contributor Author

jeromehaxhiaj-qti commented Oct 29, 2025

Hi @maehne
It seems that PR description doesn't display strings in angle brackets. I fixed it. The name is libsystemc-<version>.dll.
Changes in sc_signed.cpp and sc_unsigned.cpp are needed otherwise systemc doesn't build on msys2.

Copy link
Contributor

@maehne maehne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@barnasc
Copy link
Contributor

barnasc commented Oct 29, 2025

I confirm the name of the generated DLL is correct: systemc-3.0.2.dll

@lmailletcontoz lmailletcontoz merged commit 5ddc56e into accellera-official:main Nov 4, 2025
@jeromehaxhiaj-qti jeromehaxhiaj-qti deleted the windows_on_arm64_ci branch November 4, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants