diff options
Diffstat (limited to 'doc/manual.txt')
-rwxr-xr-x | doc/manual.txt | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/doc/manual.txt b/doc/manual.txt index 5038e292b..c1b0c0b4a 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -1529,6 +1529,7 @@ Example: finally: close(f) + The statements after the `try`:idx: are executed in sequential order unless an exception ``e`` is raised. If the exception type of ``e`` matches any of the list ``exceptlist`` the corresponding statements are executed. @@ -2324,6 +2325,7 @@ invoked by an expression following a colon:: The following example outlines a macro that generates a lexical analyzer from regular expressions: + .. code-block:: nimrod import macros @@ -2651,30 +2653,30 @@ Example: .. code-block:: nimrod {.deadCodeElim: on.} - - -Pragma pragma -------------- - -The `pragma`:idx: pragma can be used to declare user defined pragmas. This is -useful because Nimrod's templates and macros do not affect pragmas. User -defined pragmas are in a different module-wide scope than all other symbols. -They cannot be imported from a module. - -Example: - -.. code-block:: nimrod - when appType == "lib": - {.pragma: rtl, exportc, dynlib, cdecl.} - else: - {.pragma: rtl, importc, dynlib: "client.dll", cdecl.} - - proc p*(a, b: int): int {.rtl.} = - return a+b - -In the example a new pragma named ``rtl`` is introduced that either imports -a symbol from a dynamic library or exports the symbol for dynamic library -generation. + + +Pragma pragma +------------- + +The `pragma`:idx: pragma can be used to declare user defined pragmas. This is +useful because Nimrod's templates and macros do not affect pragmas. User +defined pragmas are in a different module-wide scope than all other symbols. +They cannot be imported from a module. + +Example: + +.. code-block:: nimrod + when appType == "lib": + {.pragma: rtl, exportc, dynlib, cdecl.} + else: + {.pragma: rtl, importc, dynlib: "client.dll", cdecl.} + + proc p*(a, b: int): int {.rtl.} = + return a+b + +In the example a new pragma named ``rtl`` is introduced that either imports +a symbol from a dynamic library or exports the symbol for dynamic library +generation. Disabling certain messages @@ -2786,17 +2788,18 @@ string expressions in general: **Note**: Patterns like ``libtcl(|8.5|8.4).so`` are only supported in constant strings, because they are precompiled. - + Dynlib pragma for export ------------------------- - +------------------------ + With the ``dynlib`` pragma a procedure can also be exported to -a dynamic library. The pragma then has no argument and has to be used in +a dynamic library. The pragma then has no argument and has to be used in conjunction with the ``exportc`` pragma: .. code-block:: Nimrod proc exportme(): int {.cdecl, exportc, dynlib.} - -This is only useful if the program is compiled as a dynamic library via the -``--app:lib`` command line option. - + +This is only useful if the program is compiled as a dynamic library via the +``--app:lib`` command line option. + + |