Commit Graph
8 Commits
Author SHA1 Message Date
Emmanuele Bassi d35870f3b6 Update the symbol visibility rules under MSVC
For the Visual Studio C compiler we need to annotate our public symbols
with `__declspec(dllimport)` to ensure they are visible when dynamically
linking to Epoxy's DLL.

This is needed because under Windows we use a dispatch table, instead of
wrapper functions, thus the symbol visibility rules change. Compiling
with MingW will automatically add `__declspec(dllimport)` for us.

Thanks to Nirbheek Chauhan for the help in debugging the issue.

Fixes #104
2017-02-08 16:52:01 +00:00
Emmanuele Bassi 6973dd5db3 Add a fallback for missing stdbool.h
Older versions of the Microsoft Visual C compiler do not support C99 and
do not have stdbool.h.

Additionally, Epoxy is pretty much C89 compliant, and stdbool.h is part
of C99.

We can add a simple fallback for MSVC, in case we end up getting built
with it.
2017-02-01 00:02:16 +00:00
Emmanuele Bassi 7a06803465 Improve consistency of the symbol visibility
To avoid a symbols file on Windows, Epoxy annotates all the publicly
visible symbols directly in the source, but uses the default symbol
visibility everywhere else. This means that only some symbols are
annotated as `EPOXY_IMPORTEXPORT`, and generally only on Windows.
Additionally, Epoxy has a private 'PUBLIC' pre-processor macro for
internal use, which duplicates the `EPOXY_IMPORTEXPORT` but contains
more logic to detect GCC, in case we're building with GCC on Windows.

This would be enough, except that EGL is also available on Windows,
which means we'd have to annotate the exported `epoxy_*` API inside
epoxy/egl.h as well. At that point, though, we should probably avoid
any confusion, and adopt a single symbol visibility policy across the
board.

This requires some surgery of the generated and common dispatch sources,
but cuts down the overall complexity:

 - there is only one annotation, `EPOXY_PUBLIC`, used everywhere
 - the annotation detection is done at Epoxy configuration time
 - only annotated symbols are public, on every platform
 - annotated symbols are immediately visible from the header
2017-01-25 12:43:17 +00:00
Emmanuele Bassi 0625a74d69 Add common header
We're going to use this header to provide shared macros. Right now, we
can use it to replace the:

    #ifdef __cplusplus
    extern "C" {
    #endif

    …

    #ifdef __cplusplus
    }
    #endif

Stanzas for every installed header, with easier to read macros in the
same spirit of Cairo and GLib.
2017-01-25 12:43:17 +00:00
Emmanuele Bassi 8dead45cb3 Revert all changes since 8bbc0d40
Most of the changes that happened after commit 8bbc0d40 broke epoxy
pretty much irreparably because of the CMake build and the attempt at
making libepoxy a static library that can be copy-pasted into another
project without generating files.

Since all the commits are entangled, and are full of unrelated changes,
we cannot simply do a localized set of reverts; instead, we need to hit
the reset button.

From this point forward, we're going to improve libepoxy's build while
attempting to keep the existing build system working. This may mean
reinstating the CMake build system at a later date.
2016-12-07 14:45:14 +00:00
Yaron Cohen-Tal 44d51f2844 Fix support for a static build of Epoxy. Add support building and running tests with CMake. Add support for linking with the static run-time library with MSVC. 2015-09-03 23:17:39 +03:00
Yaron Cohen-Tal 06fd4a271a Add support for CMake (no support for building/running the tests yet). Fix support for Android. Add built-in support for building with EGL support (using "khrplatform.h" and "eglplatform.h" which are distributed together with Epoxy, and should work with any platform). 2015-08-26 19:41:51 +03:00
Yaron Cohen-Tal 90c6158d61 Unite defenitions "PUBLIC" and "EPOXY_IMPORTEXPORT" and add it where appropriate. Fix tests build errors. 2015-07-19 13:40:35 +03:00