summary refs log tree commit diff stats
path: root/tests/let/timportc.nim
blob: 85244da9fba344159f2e495b6e209efbc1969791 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
discard """
targets: "c cpp js"
"""

when defined(c) or defined(cpp):
  {.emit:"""
  const int TEST1 = 123;
  #define TEST2 321
  """.}

when defined(js):
  {.emit:"""
  const TEST1 = 123;
  const TEST2 = 321; // JS doesn't have macros, so we just duplicate
  """.}

let
  TEST0 = 1
  TEST1 {.importc, nodecl.}: cint
  TEST2 {.importc, nodecl.}: cint

doAssert TEST0 == 1
doAssert TEST1 == 123
doAssert TEST2 == 321