From e1098fa01af399608f8cca72e033463c3bc13b83 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 18 Dec 2018 00:20:09 -0800 Subject: [PATCH] document NIM_EXTERNC for `emit` (#10022) --- doc/manual.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 + 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.