Skip to content

Conversation

API92
Copy link
Contributor

@API92 API92 commented Apr 30, 2017

It fixes crash (or assert failure in Debug configuration) when some .so uses other version (1.1) of rapidjson from /usr/include and overrides some (not all) rapidjson methods compiled in libcassandra.so. This reproduced when connecting to scylladb. Under debugging it looks like rapidjson::Document::StartObject (from /usr/include/rapidjson/...) called with wrong this pointer from GenericParser::ParseObject (from third_party/rapidjson/...), but preprocessor output shows only sources from third_party/rapidjson.

@datastax-bot
Copy link

Hi @API92, thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.

Sincerely,
DataStax Bot.

It fixes crash (or abort failure in Debug configuration) when some .so
uses other version (1.1) of rapidjson from /usr/include and override some (not all) rapidjson
methods compiled in libcassandra.so. This reproduced when connecting to
scylladb. In Debug configuration it looks like rapidjson::Document::StartObject (from /usr/include/rapidjson/...)
called with wrong this pointer from Parser (from third_party/rapidjson/...), but
preprocessor output shows only sources from third_party/rapidjson.
@datastax-bot
Copy link

Thank you @API92 for signing the Contribution License Agreement.

Cheers,
DataStax Bot.

@mpenick
Copy link
Contributor

mpenick commented May 9, 2017

Thanks for the patch. I'll take a look at this sometime this week.

# define CASS_IMPL_EXPORT __declspec(dllexport)
# else
# define CASS_IMPL_EXPORT __declspec(dllexport)
# endif
Copy link
Contributor

Choose a reason for hiding this comment

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

The if and else bodies are identical. Why have this if for CASS_BUILDING?

Copy link
Contributor Author

@API92 API92 May 10, 2017

Choose a reason for hiding this comment

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

This code copied from include/cassandra.h. In commit fb4c1a6 the message says that it solves some Windows warnings. But I can rewrite this code with single #define.
Really, CASS_IMPL_EXPORT needed only for exporting some symbols for unit tests. Maybe would it be better to add macro CASS_BUILDING_TESTS and only if it is set, then to define CASS_IMPL_EXPORT?

# if defined(CASS_BUILDING)
# define CASS_IMPL_EXPORT __declspec(dllexport)
# else
# define CASS_IMPL_EXPORT __declspec(dllexport)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure the #else should be __declspec(dllimport). This is an existing typo. Let me do some research.

@mpenick
Copy link
Contributor

mpenick commented Apr 9, 2019

There was an issue where dllexport was on both sides of the CASS_BUILDING branch. Please open a new PR or a JIRA issue if this hasn't fixed your issue.

@mpenick mpenick closed this Apr 9, 2019
mpenick pushed a commit that referenced this pull request Dec 10, 2019
CPP-878 - Correct compile flags for libraries and executable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants