From 2d0135632d311df8bfa5131f412fb23c43463716 Mon Sep 17 00:00:00 2001 From: Andres AG Date: Thu, 16 Mar 2017 13:57:46 +0000 Subject: [PATCH] Fix C declaration of dir functions and types This patch fixes the declaration of the DIR type and related functions so that they can be called from C code. This is necessary when enabling functionality that uses the filesystem in mbed TLS. --- platform/mbed_retarget.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/mbed_retarget.h b/platform/mbed_retarget.h index 8d3b74cebf..8751059089 100644 --- a/platform/mbed_retarget.h +++ b/platform/mbed_retarget.h @@ -50,8 +50,13 @@ typedef int mode_t; ///< Mode for opening files #if __cplusplus namespace mbed { class Dir; } typedef mbed::Dir DIR; +#else +typedef struct Dir DIR; +#endif +#if __cplusplus extern "C" { +#endif DIR *opendir(const char*); struct dirent *readdir(DIR *); int closedir(DIR*); @@ -59,6 +64,7 @@ extern "C" { long telldir(DIR*); void seekdir(DIR*, long); int mkdir(const char *name, mode_t n); +#if __cplusplus }; #endif