fix(Net): export pocoNetworkInitializer when built with clang-cl #5368#5369
Conversation
|
Alternative approach worth considering The consumer-side Two small changes would resolve #5368 without the
Why this is attractive:
Known limitation: a clang-cl-built `PocoNet.dll` consumed by a non-CMake project without `POCO_NO_AUTOMATIC_LIBS` (e.g. an MSVC solution using the auto-link pragmas) would still hit `LNK2001` because the DLL itself does not export the symbol. This PR also fixes that mixed-toolchain case; the alternative does not. `#pragma comment(linker, "/export:...")` is the documented MSVC way to export and is one of four supported export methods (/EXPORT docs), so PR #5369's producer-side approach is correct on its own merits. Just sharing as an option. |
There was a problem hiding this comment.
Pull request overview
This PR fixes automatic Net initialization symbol handling for clang-cl/MSVC-compatible Windows builds by ensuring pocoNetworkInitializer has external C linkage and the correct import/export forcing behavior.
Changes:
- Exports/imports
pocoNetworkInitializerconsistently viaextern "C"andNet_API. - Routes clang-cl through the MSVC linker pragma path instead of the generic Clang/GCC path.
- Uses the correct
/include:target for DLL consumers by referencing__imp_import symbols.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
Net/src/Net.cpp |
Updates the initializer definition to match the exported declaration. |
Net/include/Poco/Net/Net.h |
Adjusts compiler detection and linker include paths for static vs DLL Net consumers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.