[pypy-commit] cffi default: Change the Windows-friendly version to be both Windows- and
arigo
pypy.commits at gmail.com
Mon Jan 23 04:13:09 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r2866:a06c29d41c30
Date: 2017-01-23 10:12 +0100
http://bitbucket.org/cffi/cffi/changeset/a06c29d41c30/
Log: Change the Windows-friendly version to be both Windows- and POSIX-
friendly (previously it *only* compiled on Windows)
diff --git a/doc/source/embedding.rst b/doc/source/embedding.rst
--- a/doc/source/embedding.rst
+++ b/doc/source/embedding.rst
@@ -52,13 +52,25 @@
/* file plugin.h, Windows-friendly version */
typedef struct { int x, y; } point_t;
- /* When including this file from ffibuilder.set_source(),
- this macro is defined to __declspec(dllexport). When
- including this file directly from your C program, we
- define it to __declspec(dllimport) instead. */
+ /* When including this file from ffibuilder.set_source(), the
+ following macro is defined to '__declspec(dllexport)'. When
+ including this file directly from your C program, we define
+ it to 'extern __declspec(dllimport)' instead.
+
+ With non-MSVC compilers we simply define it to 'extern'.
+ (The 'extern' is needed for sharing global variables;
+ functions would be fine without it. The macros always
+ include 'extern': you must not repeat it when using the
+ macros later.)
+ */
#ifndef CFFI_DLLEXPORT
- # define CFFI_DLLEXPORT __declspec(dllimport)
+ # if defined(_MSC_VER)
+ # define CFFI_DLLEXPORT extern __declspec(dllimport)
+ # else
+ # define CFFI_DLLEXPORT extern
+ # endif
#endif
+
CFFI_DLLEXPORT int do_stuff(point_t *);
.. code-block:: python
More information about the pypy-commit
mailing list