Skip to content

Commit 036f97e

Browse files
committed
Fun with exporting symbols
1 parent d4ff3df commit 036f97e

4 files changed

Lines changed: 76 additions & 16 deletions

File tree

cpp/src/arrow/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,16 @@ if(ARROW_FILESYSTEM)
989989
${ARROW_S3_SHARED_INSTALL_INTERFACE_LIBS}
990990
STATIC_LINK_LIBS
991991
arrow_static
992-
${AWSSDK_LINK_LIBRARIES})
992+
${AWSSDK_LINK_LIBRARIES}
993+
OUTPUTS
994+
ARROW_S3_LIBRARIES)
995+
foreach(LIB_TARGET ${ARROW_S3_LIBRARIES})
996+
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_S3_EXPORTING)
997+
endforeach()
998+
if(ARROW_BUILD_STATIC AND WIN32)
999+
target_compile_definitions(arrow_s3_static PUBLIC ARROW_S3_STATIC)
1000+
endif()
1001+
9931002
set_source_files_properties(filesystem/s3fs.cc filesystem/s3fs_module.cc
9941003
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
9951004
endif()
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
#pragma once
19+
20+
#if defined(_WIN32) || defined(__CYGWIN__)
21+
# if defined(_MSC_VER)
22+
# pragma warning(push)
23+
# pragma warning(disable : 4251)
24+
# else
25+
# pragma GCC diagnostic ignored "-Wattributes"
26+
# endif
27+
28+
# ifdef ARROW_S3_STATIC
29+
# define ARROW_S3_EXPORT
30+
# elif defined(ARROW_S3_EXPORTING)
31+
# define ARROW_S3_EXPORT __declspec(dllexport)
32+
# else
33+
# define ARROW_S3_EXPORT __declspec(dllimport)
34+
# endif
35+
36+
# define ARROW_S3_NO_EXPORT
37+
38+
# if defined(_MSC_VER)
39+
# pragma warning(pop)
40+
# endif
41+
42+
#else // Not Windows
43+
# ifndef ARROW_S3_EXPORT
44+
# define ARROW_S3_EXPORT __attribute__((visibility("default")))
45+
# endif
46+
# ifndef ARROW_S3_NO_EXPORT
47+
# define ARROW_S3_NO_EXPORT __attribute__((visibility("hidden")))
48+
# endif
49+
#endif

cpp/src/arrow/filesystem/s3fs.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class STSClient;
3838
namespace arrow::fs {
3939

4040
/// Options for using a proxy for S3
41-
struct ARROW_EXPORT S3ProxyOptions {
41+
struct ARROW_S3_EXPORT S3ProxyOptions {
4242
std::string scheme;
4343
std::string host;
4444
int port = -1;
@@ -67,7 +67,7 @@ enum class S3CredentialsKind : int8_t {
6767
};
6868

6969
/// Pure virtual class for describing custom S3 retry strategies
70-
class ARROW_EXPORT S3RetryStrategy {
70+
class ARROW_S3_EXPORT S3RetryStrategy {
7171
public:
7272
virtual ~S3RetryStrategy() = default;
7373

@@ -96,7 +96,7 @@ class ARROW_EXPORT S3RetryStrategy {
9696
};
9797

9898
/// Options for the S3FileSystem implementation.
99-
struct ARROW_EXPORT S3Options {
99+
struct ARROW_S3_EXPORT S3Options {
100100
/// \brief Smart defaults for option values
101101
///
102102
/// The possible values for this setting are explained in the AWS docs:
@@ -315,7 +315,7 @@ struct ARROW_EXPORT S3Options {
315315
/// Some implementation notes:
316316
/// - buckets are special and the operations available on them may be limited
317317
/// or more expensive than desired.
318-
class ARROW_EXPORT S3FileSystem : public FileSystem {
318+
class ARROW_S3_EXPORT S3FileSystem : public FileSystem {
319319
public:
320320
~S3FileSystem() override;
321321

@@ -409,7 +409,7 @@ class ARROW_EXPORT S3FileSystem : public FileSystem {
409409

410410
enum class S3LogLevel : int8_t { Off, Fatal, Error, Warn, Info, Debug, Trace };
411411

412-
struct ARROW_EXPORT S3GlobalOptions {
412+
struct ARROW_S3_EXPORT S3GlobalOptions {
413413
/// The log level for S3-originating messages.
414414
S3LogLevel log_level;
415415

@@ -444,21 +444,21 @@ struct ARROW_EXPORT S3GlobalOptions {
444444
///
445445
/// Once this function is called you MUST call FinalizeS3 before the end of the
446446
/// application in order to avoid a segmentation fault at shutdown.
447-
ARROW_EXPORT
447+
ARROW_S3_EXPORT
448448
Status InitializeS3(const S3GlobalOptions& options);
449449

450450
/// \brief Ensure the S3 APIs are initialized, but only if not already done.
451451
///
452452
/// If necessary, this will call InitializeS3() with some default options.
453-
ARROW_EXPORT
453+
ARROW_S3_EXPORT
454454
Status EnsureS3Initialized();
455455

456456
/// Whether S3 was initialized, and not finalized.
457-
ARROW_EXPORT
457+
ARROW_S3_EXPORT
458458
bool IsS3Initialized();
459459

460460
/// Whether S3 was finalized.
461-
ARROW_EXPORT
461+
ARROW_S3_EXPORT
462462
bool IsS3Finalized();
463463

464464
/// \brief Shutdown the S3 APIs.
@@ -470,16 +470,16 @@ bool IsS3Finalized();
470470
/// Calls to InitializeS3() and FinalizeS3() should be serialized by the
471471
/// application (this also applies to EnsureS3Initialized() and
472472
/// EnsureS3Finalized()).
473-
ARROW_EXPORT
473+
ARROW_S3_EXPORT
474474
Status FinalizeS3();
475475

476476
/// \brief Ensure the S3 APIs are shutdown, but only if not already done.
477477
///
478478
/// If necessary, this will call FinalizeS3().
479-
ARROW_EXPORT
479+
ARROW_S3_EXPORT
480480
Status EnsureS3Finalized();
481481

482-
ARROW_EXPORT
482+
ARROW_S3_EXPORT
483483
Result<std::string> ResolveS3BucketRegion(const std::string& bucket);
484484

485485
} // namespace arrow::fs

cpp/src/arrow/filesystem/util_internal.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ enum class AuthorityHandlingBehavior {
8383
/// \param supported_schemes the set of URI schemes that should be accepted
8484
/// \param accept_local_paths if true, allow an absolute path
8585
/// \return the path portion of the URI
86+
ARROW_EXPORT
8687
Result<std::string> PathFromUriHelper(const std::string& uri_string,
8788
std::vector<std::string> supported_schemes,
8889
bool accept_local_paths,
@@ -95,6 +96,7 @@ ARROW_EXPORT
9596
Result<FileInfoVector> GlobFiles(const std::shared_ptr<FileSystem>& filesystem,
9697
const std::string& glob);
9798

99+
ARROW_EXPORT
98100
extern FileSystemGlobalOptions global_options;
99101

100102
/// \brief Unregister filesystem factories
@@ -106,16 +108,16 @@ ARROW_EXPORT
106108
Status UnregisterFileSystemFactory(const std::string& scheme);
107109

108110
template <typename T>
109-
Result<T> GetOption(const std::string& key, const std::any& value) {
111+
ARROW_EXPORT Result<T> GetOption(const std::string& key, const std::any& value) {
110112
if (const auto* v = std::any_cast<T>(&value)) {
111113
return *v;
112114
}
113115
return Status::Invalid("Filesystem option '", key, "' has the wrong type");
114116
}
115117

116118
template <typename T>
117-
Result<std::shared_ptr<const T>> GetConstSharedPtrOption(const std::string& key,
118-
const std::any& value) {
119+
ARROW_EXPORT Result<std::shared_ptr<const T>> GetConstSharedPtrOption(
120+
const std::string& key, const std::any& value) {
119121
if (const auto* v = std::any_cast<std::shared_ptr<const T>>(&value)) return *v;
120122
if (const auto* v = std::any_cast<std::shared_ptr<T>>(&value)) return *v;
121123
return Status::Invalid("Filesystem option '", key, "' has the wrong type");

0 commit comments

Comments
 (0)