Documentation, fix tmath on Windows
This commit is contained in:
parent
fb997526de
commit
f4d8ee1c5c
2 changed files with 19 additions and 0 deletions
|
|
@ -174,6 +174,18 @@ macro cSkipSymbol*(skips: varargs[string]): untyped =
|
||||||
gStateCT.symOverride.add skip.strVal
|
gStateCT.symOverride.add skip.strVal
|
||||||
|
|
||||||
macro cPlugin*(body): untyped =
|
macro cPlugin*(body): untyped =
|
||||||
|
## When `cOverride() <cimport.html#cOverride.m,>`_ and `cSkipSymbol() <cimport.html#cSkipSymbol.m%2Cvarargs[string]>`_
|
||||||
|
## are not adequate, the `cPlugin() <cimport.html#cPlugin.m,>`_ macro can be used to customize the generated Nim output.
|
||||||
|
## The following callbacks are available at this time.
|
||||||
|
##
|
||||||
|
## .. code-block:: nim
|
||||||
|
##
|
||||||
|
## cPlugin:
|
||||||
|
## import strutils
|
||||||
|
##
|
||||||
|
## proc onSymbol*(sym: string): string {.exportc, dynlib.} =
|
||||||
|
## return sym.strip(chars={'_'})
|
||||||
|
|
||||||
let
|
let
|
||||||
data = body.repr
|
data = body.repr
|
||||||
path = getTempDir() / "nimterop" & ($data.hash() & ".nim")
|
path = getTempDir() / "nimterop" & ($data.hash() & ".nim")
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,13 @@ cDebug()
|
||||||
cDisableCaching()
|
cDisableCaching()
|
||||||
|
|
||||||
cAddStdDir()
|
cAddStdDir()
|
||||||
|
|
||||||
|
cPlugin:
|
||||||
|
import strutils
|
||||||
|
|
||||||
|
proc onSymbol*(sym: string): string {.exportc, dynlib.} =
|
||||||
|
return sym.strip(chars={'_'})
|
||||||
|
|
||||||
cImport cSearchPath("math.h")
|
cImport cSearchPath("math.h")
|
||||||
|
|
||||||
check sin(5) == -0.9589242746631385
|
check sin(5) == -0.9589242746631385
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue