|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #1839
cdef public functions should be declared with the appropriate linkage:
* in C mode, either extern or extern "C", depending on whether the header file is included in (resp. object code is linked against) a C or a C++ compilation unit. Choice is made at compile-time through #ifdef __cplusplus macros. NB: This is the current behavior.
* in C++ mode, extern "C++" is the only option, as C code cannot call C++ code. Note that extern "C++" should be preferred over extern to allow users to #include the C++ header inside a extern "C" block (which is legal, although barely used).
Note that the current behavior is OK for C mode, but is incorrect for the C++ mode. As described in #1839, this incorrect behavior is diagnosed by compilers emitting warnings when cdef public functions return a C++ type (e.g. std::vector).
The test introduced in this PR checks that the current behavior for C mode (with both C and C++ compatibility) is preserved, and that the behavior for C++ mode is fixed.
|