diff options
| -rw-r--r-- | nimterop/cimport.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim index 1f0de30..1f82b6f 100644 --- a/nimterop/cimport.nim +++ b/nimterop/cimport.nim @@ -235,9 +235,19 @@ macro cPlugin*(body): untyped = cPlugin: import strutils + # Strip leading and trailing underscores proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = sym.name = sym.name.strip(chars={'_'}) + runnableExamples: + cPlugin: + import strutils + + # Strip prefix from procs + proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = + if sym.kind == nskProc and sym.name.contains("SDL_"): + sym.name = sym.name.replace("SDL_", "") + let data = "import nimterop/plugin\n\n" & body.repr hash = data.hash().abs() |
