diff options
| author | genotrance <dev@genotrance.com> | 2019-05-08 23:56:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-08 23:56:30 -0500 |
| commit | 2cdde946359828d724a573f96a1cda01b3b9d8e4 (patch) | |
| tree | 3cebaccaa8e7646312a8dbde65b566f66e28191c /tests | |
| parent | def527ae6052a707bb61c0cd5e3cdc8be55130a5 (diff) | |
| parent | afc9991002fb65c207d0ecf994a941efd5a1384a (diff) | |
| download | nimterop-2cdde946359828d724a573f96a1cda01b3b9d8e4.tar.gz nimterop-2cdde946359828d724a573f96a1cda01b3b9d8e4.zip | |
Dynlib support
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tpcre.nim | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/tpcre.nim b/tests/tpcre.nim new file mode 100644 index 0000000..705525f --- /dev/null +++ b/tests/tpcre.nim @@ -0,0 +1,35 @@ +import os + +import nimterop/[cimport, git, paths] + +const + baseDir = nimteropBuildDir()/"pcre" + pcreH = baseDir/"pcre.h.in" + +static: + if not pcreH.fileExists(): + downloadUrl("https://github.com/svn2github/pcre/raw/master/pcre.h.in", baseDir) + cDebug() + cDisableCaching() + +const + dynpcre = + when defined(windows): + when defined(cpu64): + "pcre64.dll" + else: + "pcre32.dll" + elif hostOS == "macosx": + "libpcre(.3|.1|).dylib" + else: + "libpcre.so(.3|.1|)" + +cPlugin: + import strutils + + proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = + sym.name = sym.name.replace("pcre_", "") + +cImport(pcreH, dynlib="dynpcre") + +echo version()
\ No newline at end of file |
