[Mesa-dev] [PATCH 1/2] egl: Add needed extern "C" for C++ access
Alexander von Gluck IV
kallisti5 at unixzen.com
Wed May 13 15:14:36 PDT 2015
* Haiku's egl driver is C++ due to the interface natively being C++
---
src/egl/main/eglapi.h | 10 ++++++++++
src/egl/main/eglarray.h | 8 ++++++++
src/egl/main/eglcompiler.h | 8 ++++++++
src/egl/main/eglconfig.h | 8 ++++++++
src/egl/main/eglcontext.h | 8 ++++++++
src/egl/main/eglcurrent.h | 8 ++++++++
src/egl/main/egldefines.h | 6 ++++++
src/egl/main/egldisplay.h | 9 +++++++++
src/egl/main/egldriver.h | 10 ++++++++++
src/egl/main/eglimage.h | 9 +++++++++
src/egl/main/egllog.h | 8 ++++++++
src/egl/main/eglsurface.h | 8 ++++++++
src/egl/main/egltypedefs.h | 10 ++++++++++
src/loader/loader.h | 9 +++++++++
14 files changed, 119 insertions(+), 0 deletions(-)
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 066a416..e07970f 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -31,6 +31,11 @@
#ifndef EGLAPI_INCLUDED
#define EGLAPI_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* A generic function ptr type
*/
@@ -209,4 +214,9 @@ struct _egl_api
#endif
};
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLAPI_INCLUDED */
diff --git a/src/egl/main/eglarray.h b/src/egl/main/eglarray.h
index 228f6c3..29b7128 100644
--- a/src/egl/main/eglarray.h
+++ b/src/egl/main/eglarray.h
@@ -34,6 +34,10 @@
#include "egltypedefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef EGLBoolean (*_EGLArrayForEach)(void *elem, void *foreach_data);
@@ -83,4 +87,8 @@ _eglGetArraySize(_EGLArray *array)
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLARRAY_INCLUDED */
diff --git a/src/egl/main/eglcompiler.h b/src/egl/main/eglcompiler.h
index b457a40..9804ca4 100644
--- a/src/egl/main/eglcompiler.h
+++ b/src/egl/main/eglcompiler.h
@@ -30,9 +30,17 @@
#ifndef EGLCOMPILER_INCLUDED
#define EGLCOMPILER_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define STATIC_ASSERT(COND) \
do { \
(void) sizeof(char [1 - 2*!(COND)]); \
} while (0)
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLCOMPILER_INCLUDED */
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index dc59ea3..84cb227 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -39,6 +39,10 @@
#include "egltypedefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* update _eglValidationTable and _eglOffsetOfConfig before updating this
* struct */
struct _egl_config
@@ -225,4 +229,8 @@ extern EGLBoolean
_eglGetConfigs(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLCONFIG_INCLUDED */
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 241917f..69bf77d 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -37,6 +37,10 @@
#include "egldisplay.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* "Base" class for device driver contexts.
*/
@@ -150,4 +154,8 @@ _eglGetContextHandle(_EGLContext *ctx)
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLCONTEXT_INCLUDED */
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index 3343755..1e386ac 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -34,6 +34,10 @@
#include "egltypedefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define _EGL_API_ALL_BITS \
(EGL_OPENGL_ES_BIT | \
EGL_OPENVG_BIT | \
@@ -115,4 +119,8 @@ extern EGLBoolean
_eglError(EGLint errCode, const char *msg);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLCURRENT_INCLUDED */
diff --git a/src/egl/main/egldefines.h b/src/egl/main/egldefines.h
index 4c9e014..a32cab2 100644
--- a/src/egl/main/egldefines.h
+++ b/src/egl/main/egldefines.h
@@ -34,6 +34,9 @@
#ifndef EGLDEFINES_INCLUDED
#define EGLDEFINES_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
#define _EGL_MAX_EXTENSIONS_LEN 1000
@@ -41,5 +44,8 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#ifdef __cplusplus
+}
+#endif
#endif /* EGLDEFINES_INCLUDED */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 36f50b9..6862e2f 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -39,6 +39,10 @@
#include "eglarray.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum _egl_platform_type {
_EGL_PLATFORM_WINDOWS,
_EGL_PLATFORM_X11,
@@ -270,4 +274,9 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
const EGLint *attrib_list);
#endif
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLDISPLAY_INCLUDED */
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 11300ce..cd95cd3 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -38,6 +38,11 @@
#include "eglapi.h"
#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Define an inline driver typecast function.
*
@@ -124,4 +129,9 @@ _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *),
void *callback_data);
+#ifdef __cplusplus
+}
+#endif
+
+
#endif /* EGLDRIVER_INCLUDED */
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 50a87a1..d06f91c 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -35,6 +35,11 @@
#include "egltypedefs.h"
#include "egldisplay.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct _egl_image_attrib_int
{
EGLint Value;
@@ -161,4 +166,8 @@ _eglGetImageHandle(_EGLImage *img)
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLIMAGE_INCLUDED */
diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h
index 12a477e..cf58525 100644
--- a/src/egl/main/egllog.h
+++ b/src/egl/main/egllog.h
@@ -34,6 +34,10 @@
#include "egltypedefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define _EGL_FATAL 0 /* unrecoverable error */
#define _EGL_WARNING 1 /* recoverable error/problem */
#define _EGL_INFO 2 /* just useful info */
@@ -55,4 +59,8 @@ extern void
_eglLog(EGLint level, const char *fmtStr, ...);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLLOG_INCLUDED */
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index 438e27c..74c429a 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -37,6 +37,10 @@
#include "egldisplay.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* "Base" class for device driver surfaces.
*/
@@ -174,4 +178,8 @@ _eglGetSurfaceHandle(_EGLSurface *surf)
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLSURFACE_INCLUDED */
diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h
index e90959a..82064a7 100644
--- a/src/egl/main/egltypedefs.h
+++ b/src/egl/main/egltypedefs.h
@@ -38,6 +38,11 @@
#include "eglcompiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct _egl_api _EGLAPI;
typedef struct _egl_array _EGLArray;
@@ -68,4 +73,9 @@ typedef struct _egl_sync _EGLSync;
typedef struct _egl_thread_info _EGLThreadInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* EGLTYPEDEFS_INCLUDED */
diff --git a/src/loader/loader.h b/src/loader/loader.h
index 810e7da..60c58f2 100644
--- a/src/loader/loader.h
+++ b/src/loader/loader.h
@@ -27,6 +27,10 @@
#ifndef LOADER_H
#define LOADER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Helpers to figure out driver and device name, eg. from pci-id, etc. */
#define _LOADER_DRI (1 << 0)
@@ -61,4 +65,9 @@ loader_get_user_preferred_fd(int default_fd, int *different_device);
void
loader_set_logger(void (*logger)(int level, const char *fmt, ...));
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* LOADER_H */
--
1.7.1
More information about the mesa-dev
mailing list