diff options
author | Don-Duong Quach <geekrelief@gmail.com> | 2022-07-17 00:32:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 09:32:33 +0200 |
commit | efdcc0016913918eb303f5c34ae805b94f270a1a (patch) | |
tree | e00194eabb5c7a646e7d9ddb11d060aef1b4e65c | |
parent | 01ad0cdc5212a05ac31c968facdc94b732dd48ef (diff) | |
download | Nim-efdcc0016913918eb303f5c34ae805b94f270a1a.tar.gz |
Fixed errors in Nim Backend integration docs. (#20046)
Fixed errors in Nim Backend integration. Section "Nim invocation example from C" NimMain needs a declaration and function declarations have external linkage by default. Also with the order of arguments to gcc with a static lib, maths.c needs to come before the static lib.
-rw-r--r-- | doc/backends.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/backends.md b/doc/backends.md index a135e78b0..8d49af119 100644 --- a/doc/backends.md +++ b/doc/backends.md @@ -270,7 +270,8 @@ Create a ``maths.c`` file with the following content: #include <stdio.h> - extern int fib(int a); + int fib(int a); + void NimMain(); int main(void) { @@ -302,7 +303,7 @@ also ask the Nim compiler to generate a statically linked library: .. code:: cmd nim c --app:staticLib --noMain fib.nim - gcc -o m -Inimcache -Ipath/to/nim/lib libfib.nim.a maths.c + gcc -o m -Inimcache -Ipath/to/nim/lib maths.c libfib.nim.a The Nim compiler will handle linking the source files generated in the ``nimcache`` directory into the ``libfib.nim.a`` static library, which you can |