[libbluray-devel] mark exported const variables with extern keyword when compiling with C++ compiler .

hpi1 git at videolan.org
Thu Feb 7 22:40:03 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Feb  7 23:37:44 2013 +0200| [11c8f1c903bd14775747f1d4ab84da8deca47870] | committer: hpi1

mark exported const variables with extern keyword when compiling with C++ compiler.
in C++ const implies static, extern reverses this.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=11c8f1c903bd14775747f1d4ab84da8deca47870
---

 src/libbluray/bdj/native/java_awt_BDFontMetrics.c |   10 ++++++++--
 src/libbluray/bdj/native/java_awt_BDGraphics.c    |   10 ++++++++--
 src/libbluray/bdj/native/org_videolan_Libbluray.c |   10 ++++++++--
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/native/java_awt_BDFontMetrics.c b/src/libbluray/bdj/native/java_awt_BDFontMetrics.c
index 783df01..c72ceaa 100644
--- a/src/libbluray/bdj/native/java_awt_BDFontMetrics.c
+++ b/src/libbluray/bdj/native/java_awt_BDFontMetrics.c
@@ -37,6 +37,12 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #endif
 
+#ifdef __cplusplus
+#define CPP_EXTERN extern
+#else
+#define CPP_EXTERN
+#endif
+
 JNIEXPORT jlong JNICALL
 Java_java_awt_BDFontMetrics_initN(JNIEnv * env, jclass cls)
 {
@@ -184,7 +190,7 @@ Java_java_awt_BDFontMetrics_charsWidthN(JNIEnv * env, jobject obj, jlong ftFace,
 #define CC (char*)  /*cast a literal from (const char*)*/
 #pragma GCC diagnostic ignored "-Wcast-qual"
 
-BD_PRIVATE const JNINativeMethod
+BD_PRIVATE CPP_EXTERN const JNINativeMethod
 Java_java_awt_BDFontMetrics_methods[] =
 { /* AUTOMATICALLY GENERATED */
     {
@@ -224,6 +230,6 @@ Java_java_awt_BDFontMetrics_methods[] =
     },
 };
 
-BD_PRIVATE extern const int
+BD_PRIVATE CPP_EXTERN const int
 Java_java_awt_BDFontMetrics_methods_count =
     sizeof(Java_java_awt_BDFontMetrics_methods)/sizeof(Java_java_awt_BDFontMetrics_methods[0]);
diff --git a/src/libbluray/bdj/native/java_awt_BDGraphics.c b/src/libbluray/bdj/native/java_awt_BDGraphics.c
index b793dd0..58e903f 100644
--- a/src/libbluray/bdj/native/java_awt_BDGraphics.c
+++ b/src/libbluray/bdj/native/java_awt_BDGraphics.c
@@ -39,6 +39,12 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #endif
 
+#ifdef __cplusplus
+#define CPP_EXTERN extern
+#else
+#define CPP_EXTERN
+#endif
+
 JNIEXPORT void JNICALL
 Java_java_awt_BDGraphics_drawStringN(JNIEnv * env, jobject obj, jlong ftFace, jstring string, jint x, jint y, jint rgb)
 {
@@ -88,7 +94,7 @@ Java_java_awt_BDGraphics_drawStringN(JNIEnv * env, jobject obj, jlong ftFace, js
 #define CC (char*)  /*cast a literal from (const char*)*/
 #pragma GCC diagnostic ignored "-Wcast-qual"
 
-BD_PRIVATE const JNINativeMethod
+BD_PRIVATE CPP_EXTERN const JNINativeMethod
 Java_java_awt_BDGraphics_methods[] =
 { /* AUTOMATICALLY GENERATED */
     {
@@ -98,6 +104,6 @@ Java_java_awt_BDGraphics_methods[] =
     },
 };
 
-BD_PRIVATE extern const int
+BD_PRIVATE CPP_EXTERN const int
 Java_java_awt_BDGraphics_methods_count =
      sizeof(Java_java_awt_BDGraphics_methods)/sizeof(Java_java_awt_BDGraphics_methods[0]);
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index a92f2c1..03a14c3 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -42,6 +42,12 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #endif
 
+#ifdef __cplusplus
+#define CPP_EXTERN extern
+#else
+#define CPP_EXTERN
+#endif
+
 static jobject _make_title_info(JNIEnv* env, int title, int objType, int playbackType, const char* bdjoName, int hdmvOID)
 {
     jstring name = bdjoName ? (*env)->NewStringUTF(env, bdjoName) : NULL;
@@ -444,7 +450,7 @@ JNIEXPORT void JNICALL Java_org_videolan_Libbluray_updateGraphicN(JNIEnv * env,
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
 
-BD_PRIVATE const JNINativeMethod
+BD_PRIVATE CPP_EXTERN const JNINativeMethod
 Java_org_videolan_Libbluray_methods[] =
 { /* AUTOMATICALLY GENERATED */
     {
@@ -589,7 +595,7 @@ Java_org_videolan_Libbluray_methods[] =
     },
 };
 
-BD_PRIVATE extern const int
+BD_PRIVATE CPP_EXTERN const int
 Java_org_videolan_Libbluray_methods_count =
     sizeof(Java_org_videolan_Libbluray_methods)/sizeof(Java_org_videolan_Libbluray_methods[0]);
 



More information about the libbluray-devel mailing list