summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/manual.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index a646b7963..4a1ad9d5e 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -7365,6 +7365,17 @@ Example:
 
   embedsC()
 
+``nimbase.h`` defines ``NIM_EXTERNC`` C macro that can be used for
+``extern "C"`` code to work with both ``nim c`` and ``nim cpp``, eg:
+
+.. code-block:: Nim
+  proc foobar() {.importc:"$1".}
+  {.emit: """
+  #include <stdio.h>
+  NIM_EXTERNC
+  void fun(){}
+  """.}
+
 For backwards compatibility, if the argument to the ``emit`` statement
 is a single string literal, Nim symbols can be referred to via backticks.
 This usage is however deprecated.