mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-10 15:04:59 +00:00
Hyperlinks together importc like pragmas.
This commit is contained in:
@@ -5488,7 +5488,10 @@ spelled*:
|
||||
proc printf(formatstr: cstring) {.header: "<stdio.h>", importc: "printf", varargs.}
|
||||
|
||||
Note that this pragma is somewhat of a misnomer: Other backends will provide
|
||||
the same feature under the same name.
|
||||
the same feature under the same name. Also, if you are interfacing with C++
|
||||
you can use the `ImportCpp pragma <nimrodc.html#importcpp-pragma>`_ and
|
||||
interfacing with Objective-C the `ImportObjC pragma
|
||||
<nimrodc.html#importobjc-pragma>`_.
|
||||
|
||||
|
||||
Exportc pragma
|
||||
|
||||
@@ -384,10 +384,11 @@ Example:
|
||||
|
||||
ImportCpp pragma
|
||||
----------------
|
||||
The ``importcpp`` pragma can be used to import `C++`:idx: methods. The
|
||||
generated code then uses the C++ method calling syntax: ``obj->method(arg)``.
|
||||
In addition with the ``header`` and ``emit`` pragmas this allows *sloppy*
|
||||
interfacing with libraries written in C++:
|
||||
Similar to the `importc pragma for C <manual.html#importc-pragma>`_, the
|
||||
``importcpp`` pragma can be used to import `C++`:idx: methods. The generated
|
||||
code then uses the C++ method calling syntax: ``obj->method(arg)``. In
|
||||
addition with the ``header`` and ``emit`` pragmas this allows *sloppy*
|
||||
interfacing with libraries written in C++:
|
||||
|
||||
.. code-block:: Nimrod
|
||||
# Horrible example of how to interface with a C++ engine ... ;-)
|
||||
@@ -422,11 +423,11 @@ emits C++ code.
|
||||
|
||||
ImportObjC pragma
|
||||
-----------------
|
||||
The ``importobjc`` pragma can be used to import `Objective C`:idx: methods.
|
||||
The generated code then uses the Objective C method calling
|
||||
syntax: ``[obj method param1: arg]``.
|
||||
In addition with the ``header`` and ``emit`` pragmas this allows *sloppy*
|
||||
interfacing with libraries written in Objective C:
|
||||
Similar to the `importc pragma for C <manual.html#importc-pragma>`_, the
|
||||
``importobjc`` pragma can be used to import `Objective C`:idx: methods. The
|
||||
generated code then uses the Objective C method calling syntax: ``[obj method
|
||||
param1: arg]``. In addition with the ``header`` and ``emit`` pragmas this
|
||||
allows *sloppy* interfacing with libraries written in Objective C:
|
||||
|
||||
.. code-block:: Nimrod
|
||||
# horrible example of how to interface with GNUStep ...
|
||||
|
||||
Reference in New Issue
Block a user