-// we can't use METHODDEF here as it includes static yet the functions must be
-// extern "C" and these can't be used together!
-#undef METHODDEF
-#define METHODDEF(type) extern "C" wxC_CALLING_CONV type
+// ----------------------------------------------------------------------------
+// types
+// ----------------------------------------------------------------------------
+
+// the standard definition of METHODDEF(type) from jmorecfg.h is "static type"
+// which means that we can't declare the method functions as extern "C" - the
+// compiler (rightfully) complains about the multiple storage classes in
+// declaration
+//
+// so we only add extern "C" when using our own, modified, jmorecfg.h - and use
+// whatever we have in the system headers if this is what we use hoping that it
+// should be ok (can't do anything else)
+#ifdef JPEG_METHOD_LINKAGE
+ #define CPP_METHODDEF(type) extern "C" METHODDEF(type)
+#else // not using our jmorecfg.h header
+ #define CPP_METHODDEF(type) METHODDEF(type)
+#endif