diff --git a/include/bits/errno.h b/include/bits/errno.h index 1ade524d96342231283ca385b02358b485dcdb34..c8594c12f7fb10c796369c6f97864af6cb2dda48 100644 --- a/include/bits/errno.h +++ b/include/bits/errno.h @@ -1,7 +1,15 @@ #ifndef _BITS_ERRNO_H #define _BITS_ERRNO_H +#ifdef __cplusplus +extern "C" { +#endif + //TODO extern __thread int errno; extern int errno; +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* _BITS_ERRNO_H */ diff --git a/include/bits/fcntl.h b/include/bits/fcntl.h index fff8987b2378986c50ef328b036247ab4ab8cdf0..377644773619ab4c0eab9e66d2cce3c860b324a1 100644 --- a/include/bits/fcntl.h +++ b/include/bits/fcntl.h @@ -1,7 +1,15 @@ #ifndef _BITS_FCNTL_H #define _BITS_FCNTL_H +#ifdef __cplusplus +extern "C" { +#endif + int open(const char* filename, int flags, ...); int fcntl(int fildes, int cmd, ...); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/include/bits/stdio.h b/include/bits/stdio.h index 9d4a595df3c8d45bbca8a4f398ab91ecd434011e..0af8e6acdb47f04d8d629341d32d4409336c70af 100644 --- a/include/bits/stdio.h +++ b/include/bits/stdio.h @@ -5,6 +5,10 @@ typedef struct FILE FILE; +#ifdef __cplusplus +extern "C" { +#endif + int fprintf(FILE * stream, const char * fmt, ...); int printf(const char * fmt, ...); int snprintf(char *s, size_t n, const char * fmt, ...); @@ -13,4 +17,8 @@ int fscanf(FILE * stream, const char * fmt, ...); int scanf(const char * fmt, ...); int sscanf(const char * input, const char * fmt, ...); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* _BITS_STDIO_H */ diff --git a/include/bits/unistd.h b/include/bits/unistd.h index e37f3d2ad2ff899d17422be4bfc6f55ce03a2098..da27ac6fd36250ca5c93a879ff03207f257f2b20 100644 --- a/include/bits/unistd.h +++ b/include/bits/unistd.h @@ -3,7 +3,15 @@ #define _POSIX_VERSION 200809L +#ifdef __cplusplus +extern "C" { +#endif + int execl(const char *path, const char* argv0, ...); int execle(const char *path, const char* argv0, ...); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/include/getopt.h b/include/getopt.h index 32575f15133ff31ffebbb18ea2f9667cd4e8838b..3db90d7080d7ef70f13c3ea0951f662cb8e8c84c 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -4,10 +4,18 @@ // Generated from: // `grep "opt" target/include/unistd.h` +#ifdef __cplusplus +extern "C" { +#endif + extern char* optarg; extern int opterr; extern int optind; extern int optopt; int getopt(int argc, char *const *argv, const char *optstring); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/include/malloc.h b/include/malloc.h index d7c21badfbb844d90bcddb8c1941936999f573dc..9826495495a4c944fc697807b8c55354b91d5086 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -6,6 +6,10 @@ // Generated from: // `grep "malloc\|calloc\|realloc\|free\|valloc\|memalign" target/include/stdlib.h` +#ifdef __cplusplus +extern "C" { +#endif + void *calloc(size_t nelem, size_t elsize); void free(void *ptr); void *malloc(size_t size); @@ -13,4 +17,8 @@ void *memalign(size_t alignment, size_t size); void *realloc(void *ptr, size_t size); void *valloc(size_t size); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/include/setjmp.h b/include/setjmp.h index 837b21bafa2415b205e4b39452b9e215fee8f2e1..2971781cc13553f4bee95635b7e7f5d83f491b28 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -61,7 +61,15 @@ typedef unsigned long long jmp_buf[8]; typedef unsigned long jmp_buf[8]; #endif +#ifdef __cplusplus +extern "C" { +#endif + int setjmp(jmp_buf buf); void longjmp(jmp_buf buf, int value); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* _SETJMP_H */