Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix C++ client cannot be built on Windows(apache#10363)
### Motivation C++ source code cannot be built on Windows. The build commands are: ```powershell > cmake -B _builds -S . ` -DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF > cmake --build .\_builds\ ``` There're two errors. One is > pulsar-client-cpp\lib\ReaderImpl.h(34): error C2144: syntax error: 'int' should be preceded by ';' > ... It's because `PULSAR_PUBLIC` is `__declspec(dllexport)` on Windows platform and it should be put before the variable type. The other error is > LINK : fatal error LNK1104: cannot open file 'pulsar.lib' pulsar\pulsar-client-cpp\_builds \examples\SampleReaderCApi.vcxproj] > ... It looks like when files under `examples` and `perf` directories were compiled, it tried to link `pulsar.lib` and CMake target `pulsarShared`'s name has a `dll` suffix, like `pulsardll.lib` and `pulsardll.dll`. The suffix is redundant. ### Modifications - Put `PULSAR_PUBLIC` before the variable type. - Keep the `LIB_NAME` as the shared library's name, i.e. remove the `dll` suffix. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is a trivial rework / code cleanup without any test coverage.
- Loading branch information