1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
Description: export C ABI in shared library whenever possible
Author: Armin Novak <akallabeth@posteo.net>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042096
Forwarded: https://github.com/lvandeve/lodepng/pull/182
Reviewed-by: Shengqi Chen <harry-chen@outlook.com
Last-Update: 2024-09-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lodepng.h
+++ b/lodepng.h
@@ -28,6 +28,9 @@
#include <string.h> /*for size_t*/
+#ifdef __cplusplus
+extern "C" {
+#endif
extern const char* LODEPNG_VERSION_STRING;
/*
@@ -102,6 +105,10 @@
#define LODEPNG_COMPILE_CRC
#endif
+#ifdef __cplusplus
+}
+#endif
+
/*compile the C++ version (you can disable the C++ wrapper here even when compiling for C++)*/
#ifdef __cplusplus
#ifndef LODEPNG_NO_COMPILE_CPP
@@ -116,6 +123,10 @@
#include <string>
#endif /*LODEPNG_COMPILE_CPP*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef LODEPNG_COMPILE_PNG
/*The PNG color types (also used for raw image).*/
typedef enum LodePNGColorType {
@@ -246,6 +257,9 @@
#endif /*LODEPNG_COMPILE_DISK*/
#endif /*LODEPNG_COMPILE_ENCODER*/
+#ifdef __cplusplus
+}
+#endif
#ifdef LODEPNG_COMPILE_CPP
namespace lodepng {
@@ -303,6 +317,10 @@
#endif /*LODEPNG_COMPILE_CPP*/
#endif /*LODEPNG_COMPILE_PNG*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef LODEPNG_COMPILE_ERROR_TEXT
/*Returns an English description of the numerical error code.*/
const char* lodepng_error_text(unsigned code);
@@ -1190,6 +1208,10 @@
unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename);
#endif /*LODEPNG_COMPILE_DISK*/
+#ifdef __cplusplus
+}
+#endif
+
#ifdef LODEPNG_COMPILE_CPP
/* The LodePNG C++ wrapper uses std::vectors instead of manually allocated memory buffers. */
namespace lodepng {
|