Include C++ code in the ctypes test suite?

I'm currently working on a patch that adds the __thiscall calling convention to ctypes. This calling convention is used on Windows for calling member functions from C++ classes. The idea is to eventually allow ctypes to wrap C++ classes.
To test this functionality it is required to add some C++ source code to the ctypes private test module _ctypes_test.pyd/_ctypes_test.so.
Is it appropriate to add C++ source files to the Python repository, or would that create too much trouble on some platforms?

On Thu, Jan 29, 2009 at 10:27 AM, Thomas Heller theller@ctypes.org wrote:
Is it appropriate to add C++ source files to the Python repository, or would that create too much trouble on some platforms?
I don't see a problem with that as long as platforms without C++ compilers aren't affected in the build process.

Thomas Heller schrieb:
To test this functionality it is required to add some C++ source code to the ctypes private test module _ctypes_test.pyd/_ctypes_test.so.
Is it appropriate to add C++ source files to the Python repository, or would that create too much trouble on some platforms?
How about creating an additional test library ctypes_test_cpp.cpp? This way we can still run the ctypes tests on a platform without a C++ compiler. Of course you could add some preprocessor magic but that's just another way to ask for trouble. A second test library should make it easier.
Christian

Thomas Heller <theller <at> ctypes.org> writes:
To test this functionality it is required to add some C++ source code to the ctypes private test module _ctypes_test.pyd/_ctypes_test.so.
Perhaps you should create a separate test module (_ctypes_pp_test?) so that platforms without a properly configured C++ compiler can still run the other tests.
(I also suppose configure can detect the presence of a C++ compiler...)
Regards
Antoine.

On Thu, Jan 29, 2009 at 11:50 AM, Antoine Pitrou solipsis@pitrou.net wrote: ..
(I also suppose configure can detect the presence of a C++ compiler...)
This test is already there:
$ ./configure ... checking for g++... g++ configure: WARNING:
By default, distutils will build C++ extension modules with "g++". If this is not intended, then set CXX on the configure command line. ...

Is it appropriate to add C++ source files to the Python repository, or would that create too much trouble on some platforms?
I think there will be massive portability problems, which only fade after one or two years, until this actually works everywhere.
So failure of this to work shouldn't break the Python build, and, preferably, the build process should suggest the user what might have happened when it failed.
Regards, Martin
participants (6)
-
"Martin v. Löwis"
-
Alexander Belopolsky
-
Antoine Pitrou
-
Benjamin Peterson
-
Christian Heimes
-
Thomas Heller