mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
document NIM_EXTERNC for emit (#10022)
This commit is contained in:
committed by
Andreas Rumpf
parent
c4e3c4ca2d
commit
e1098fa01a
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user