exportc now mangles same as importc, fixes #10578 (#12144)

* fixes #10578
* add tests
* add changelog
* add {.exportcpp.}
This commit is contained in:
Timothee Cour 2019-09-06 03:54:44 -07:00 • committed by Andreas Rumpf
commit 32769c478b
7 changed files with 76 additions and 34 deletions

22
tests/cpp/texportc.nim Normal file
View file

@ -0,0 +1,22 @@
discard """
targets: "c cpp"
"""
var fun0 {.importc.}: int
proc fun1() {.importc.}
proc fun2() {.importc: "$1".}
proc fun3() {.importc: "fun3Bis".}
when defined cpp:
# proc funx1() {.importcpp.} # this does not work yet
proc funx1() {.importc: "_Z5funx1v".}
doAssert fun0 == 10
fun1()
fun2()
fun3()
when defined cpp:
funx1()
import ./mexportc