This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0a1b4e23de99b5ed5c7661a6f66ed880229ee7a5
Author: xuxin19 <[email protected]>
AuthorDate: Wed Mar 26 22:19:21 2025 +0800

    include/sys/inotify.h: add extern "C" for C++
    
    The inotify prototypes were not inside an extern "C" block, so C++
    code that calls inotify_init(), inotify_add_watch() or
    inotify_rm_watch() referenced mangled names and failed to link.
    
    Put the prototypes in an extern "C" block, as other headers do.
    
    Signed-off-by: xuxin19 <[email protected]>
---
 include/sys/inotify.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/sys/inotify.h b/include/sys/inotify.h
index fdc488800f6..e0107631c6f 100644
--- a/include/sys/inotify.h
+++ b/include/sys/inotify.h
@@ -87,6 +87,11 @@ struct inotify_event
  * Public Function Prototypes
  ****************************************************************************/
 
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
 /****************************************************************************
  * Name: inotify_init
  *
@@ -168,4 +173,8 @@ int inotify_add_watch(int fd, FAR const char *pathname, 
uint32_t mask);
 
 int inotify_rm_watch(int fd, int wd);
 
+#if defined(__cplusplus)
+}
 #endif
+
+#endif /* __INCLUDE_SYS_INOTIFY_H */

Reply via email to