summary refs log tree commit diff stats
path: root/tests/pragmas
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-10-07 00:09:28 +0200
committerGitHub <noreply@github.com>2020-10-07 00:09:28 +0200
commit51e3e0c7c43e82932d9bbae2e6ccc876d29b9fab (patch)
treecadf5672a513a4d7b1fab1963f2222a27d7332b7 /tests/pragmas
parentdd862285483b402424607d5a1365d99cbd8566c7 (diff)
downloadNim-51e3e0c7c43e82932d9bbae2e6ccc876d29b9fab.tar.gz
implements https://github.com/nim-lang/RFCs/issues/260 (#15505)
* implements https://github.com/nim-lang/RFCs/issues/260

* added a test case
Diffstat (limited to 'tests/pragmas')
-rw-r--r--tests/pragmas/cfunction.c4
-rw-r--r--tests/pragmas/tcompile_pragma.nim9
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/pragmas/cfunction.c b/tests/pragmas/cfunction.c
new file mode 100644
index 000000000..bf49d6a29
--- /dev/null
+++ b/tests/pragmas/cfunction.c
@@ -0,0 +1,4 @@
+
+int cfunction(void) {
+  return NUMBER_HERE;
+}
diff --git a/tests/pragmas/tcompile_pragma.nim b/tests/pragmas/tcompile_pragma.nim
new file mode 100644
index 000000000..4e09a7501
--- /dev/null
+++ b/tests/pragmas/tcompile_pragma.nim
@@ -0,0 +1,9 @@
+discard """
+  output: '''34'''
+"""
+
+{.compile("cfunction.c", "-DNUMBER_HERE=34").}
+
+proc cfunction(): cint {.importc.}
+
+echo cfunction()