-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Nim/SV interface work even when Nim is compiled to C++
Thanks to @jrfondren. Ref: - https://gitter.im/nim-lang/Nim?at=5cc377b03d78aa6c039e4bb7 - nim-lang/Nim#10578
- Loading branch information
1 parent
4d17613
commit 5344cac
Showing
3 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
# Time-stamp: <2019-01-22 13:40:01 kmodi> | ||
# Time-stamp: <2019-04-26 17:48:17 kmodi> | ||
|
||
.DEFAULT_GOAL := default | ||
|
||
GIT_ROOT = $(shell git rev-parse --show-toplevel) | ||
include $(GIT_ROOT)/makefile | ||
|
||
# Compiles to C | ||
default: libdpi nc | ||
|
||
# Compiles to C++ | ||
cpp: | ||
$(MAKE) libdpi NIM_COMPILES_TO=cpp | ||
$(MAKE) nc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
when defined(cpp): | ||
{.push codegenDecl: """extern "C" $1 $2 $3""".} | ||
|
||
proc hello() {.exportc.} = | ||
echo "Hello from Nim!" | ||
|
||
when defined(cpp): | ||
{.pop.} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters