Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix symbol visibility for user extensions #386

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

AdamGlustein
Copy link
Collaborator

No description provided.

@AdamGlustein
Copy link
Collaborator Author

@AdamGlustein AdamGlustein marked this pull request as draft November 8, 2024 20:54
@@ -29,6 +35,10 @@ if(CSP_BUILD_PARQUET_ADAPTER)
${VENDORED_PYARROW_ROOT}/arrow/python/csv.cc
${VENDORED_PYARROW_ROOT}/arrow/python/filesystem.cc)
add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp ${ARROW_PYTHON_SRCS})
generate_export_header(parquetadapterimpl
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use PREFIX_NAME CSP here instead of BASE_NAME + EXPORT_MACRO_NAME

@AdamGlustein AdamGlustein force-pushed the fix-symbol-visibility-for-user-extensions branch from 6862748 to a284577 Compare November 8, 2024 22:45
@@ -25,7 +27,11 @@ set(CORE_SOURCE_FILES

configure_file(Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/cpp/csp/core/Config.h)

add_library(csp_core STATIC ${CORE_SOURCE_FILES})
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you intentionally change from static to shared here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, the issue was the test binaries link against csp_core directly. as-is, the static build of csp_core is built without cspimpl export macro, so the classes are marked as dllimport which results in failed imports.

Adam and I discussed a few solutions, one of which is just making csp_core shared and creating its own export macro. another is to continue to build csp_core statically (with its own export macro, cmake's export macro for static libs is a no-op, or none at all), and have users link to that directly instead of cspimpl to get at classes like DateTime. basically need to have exactly one dllexport of each class in any .dll in one way or another if it is ever marked dllimport

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, as Sorin explained this is so csp_core / csp_engine can individually export their symbols for tests (or any C++ binary that links them in without cspimpl).
I had tried to export most of these symbols in cspimpl but that approach did not work for the above reason.

@@ -15,7 +15,7 @@ namespace csp
{

// Extremely basic non-thread safe fixed-size allocator
class BasicAllocator
class CSPCORE_EXPORT BasicAllocator
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like most of these classes under core/ are header-only and shouldn't be exported since on windows this means anyone linking against these would link as dllimport; but there's no concrete dllexport for the header-only classes in csp_core.dll

@AdamGlustein AdamGlustein force-pushed the fix-symbol-visibility-for-user-extensions branch 4 times, most recently from 7e1f337 to 7649004 Compare November 11, 2024 16:54
@AdamGlustein AdamGlustein force-pushed the fix-symbol-visibility-for-user-extensions branch from 7649004 to 4d826a6 Compare November 11, 2024 17:06
@timkpaine timkpaine added type: bug Concrete, reproducible bugs part: build Issues and PRs related to the build process labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: build Issues and PRs related to the build process type: bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants