File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 3131#include " response.h"
3232#include " utils.h"
3333
34+ #if defined(_WIN32) && defined(GetObject)
35+ #pragma push_macro("GetObject")
36+ #undef GetObject
37+ #define MINIO_CPP_GET_OBJECT_DEFINED
38+ #endif
39+
3440namespace minio ::s3 {
3541
3642utils::Multimap GetCommonListObjectsQueryParams (
@@ -150,8 +156,31 @@ class BaseClient {
150156 StatObjectResponse StatObject (StatObjectArgs args);
151157 UploadPartResponse UploadPart (UploadPartArgs args);
152158 UploadPartCopyResponse UploadPartCopy (UploadPartCopyArgs args);
159+
160+ // Windows API fix:
161+ //
162+ // Windows API headers define `GetObject()` as a macro that expands to either
163+ // `GetObjectA()` or `GetObjectW()`. This means that users can get link errors
164+ // in case that one compilation unit used `GetObject()` macro and other
165+ // didn't. This fixes the issue by providing both functions `GetObject()` can
166+ // expand to as inline wrappers.
167+ #if defined(_WIN32)
168+ inline GetObjectResponse GetObjectA (const GetObjectArgs& args) {
169+ return GetObject (args);
170+ }
171+
172+ inline GetObjectResponse GetObjectW (const GetObjectArgs& args) {
173+ return GetObject (args);
174+ }
175+ #endif // _WIN32
176+
153177}; // class BaseClient
154178
155179} // namespace minio::s3
156180
181+ #if defined(_WIN32) && defined(MINIO_CPP_GET_OBJECT_DEFINED)
182+ #undef MINIO_CPP_GET_OBJECT_DEFINED
183+ #pragma pop_macro("GetObject")
184+ #endif
185+
157186#endif // MINIO_CPP_BASECLIENT_H_INCLUDED
Original file line number Diff line number Diff line change 4343#include " miniocpp/types.h"
4444#include " miniocpp/utils.h"
4545
46+ // We want exactly `minio::s3::BaseClient::GetObject()` symbol and nothing else.
47+ #if defined(GetObject)
48+ #undef GetObject
49+ #endif
50+
4651namespace minio ::s3 {
4752
4853utils::Multimap GetCommonListObjectsQueryParams (
You can’t perform that action at this time.
0 commit comments