Skip to content

Commit 2d01356

Browse files
author
Andres AG
committed
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.
1 parent cc58a7f commit 2d01356

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

platform/mbed_retarget.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,21 @@ typedef int mode_t; ///< Mode for opening files
5050
#if __cplusplus
5151
namespace mbed { class Dir; }
5252
typedef mbed::Dir DIR;
53+
#else
54+
typedef struct Dir DIR;
55+
#endif
5356

57+
#if __cplusplus
5458
extern "C" {
59+
#endif
5560
DIR *opendir(const char*);
5661
struct dirent *readdir(DIR *);
5762
int closedir(DIR*);
5863
void rewinddir(DIR*);
5964
long telldir(DIR*);
6065
void seekdir(DIR*, long);
6166
int mkdir(const char *name, mode_t n);
67+
#if __cplusplus
6268
};
6369
#endif
6470

0 commit comments

Comments
 (0)