diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2018-12-18 00:20:09 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-12-18 09:20:09 +0100 |
commit | e1098fa01af399608f8cca72e033463c3bc13b83 (patch) | |
tree | 7c9febec251fc7c9069db1f25675251834938ec4 /doc/manual.rst | |
parent | c4e3c4ca2d0a1f44ed1e3dd9db564b66031f0843 (diff) | |
download | Nim-e1098fa01af399608f8cca72e033463c3bc13b83.tar.gz |
document NIM_EXTERNC for `emit` (#10022)
Diffstat (limited to 'doc/manual.rst')
-rw-r--r-- | doc/manual.rst | 11 |
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. |