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

Collect platform detection code in a single header #506

Open
yallop opened this issue Jan 27, 2017 · 0 comments
Open

Collect platform detection code in a single header #506

yallop opened this issue Jan 27, 2017 · 0 comments

Comments

@yallop
Copy link
Owner

yallop commented Jan 27, 2017

A few parts of the code are preprocessor-conditionalized by platform, e.g. posix_types_stubs.c:

#if (!defined _WIN32 || defined __CYGWIN__) && !defined MINIOS

and ldouble_stubs.c:

#ifdef __ANDROID__

It'd be useful to centralize platform detection in a separate file (ctypes.config.h or similar) and break up the conditional compilation into two steps:

  1. ctypes_config.h should define macros that represent whether features are available

    #ifndef __ANDROID__
    #define HAVE_CEXP
    ...
  2. the rest of the code should branch on feature availability rather than platform

     #ifdef HAVE_CEXP
      ...

In the longer term we might generate ctypes_config.h via a script run at configuration time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant