Add dynlib support
This commit is contained in:
parent
def527ae60
commit
7611093750
8 changed files with 125 additions and 40 deletions
35
tests/tpcre.nim
Normal file
35
tests/tpcre.nim
Normal file
|
|
@ -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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue