-
Notifications
You must be signed in to change notification settings - Fork 777
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
Avoid includes within extern C
namespace
#960
Comments
possibly ? To be investigated. |
What would make sense is to fold this objective into the planned effort to separate the source code into multiple small units. |
Thanks for the reply! #if defined(__cplusplus)
extern `C`
#endif
// some code
#if something
#include <x>
#endif
// some more code
#if defined(__cplusplus)
}
#endif to #if defined(__cplusplus)
extern `C`
#endif
// some code
#if defined(__cplusplus)
}
#endif
#if something
#include <x>
#endif
#if define(__cplusplus)
extern `C`
#endif
// some more code
#if defined(__cplusplus)
}
#endif unsure if doing this via macro or something would make sense. |
There are limits (one cannot generate macros with macros), but yeah, something like that is indeed possible. |
As another possible solution, we'll be able to use the following inline extern C style
We can also define it as a macro
Msvc's dllexport is able to be supported in the same style. |
Line 244 of xxhash.h has a:
that is followed up by includes of system-provided headers, that are not guaranteed to work within an
extern C
linkage rules.In particular, while compiling apache-arrow with Emscripten, I get:
that make compilation fail.
Current workaround, very much ad-hoc, is explicitly including
<emscripten.h>
(conditionally on EMSCRIPTEN being defined) before includingxxhash.h
. This works, but it's not great and solves only this specific case. PR is at duckdb/duckdb-wasm#1803.Would it be possible to move the includes outside of the
extern C
namespace, given I believe not to be compliant with C++ compilers?Thanks a lot.
The text was updated successfully, but these errors were encountered: