added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235)

This commit is contained in:
Andreas Rumpf
2021-12-10 14:28:59 +01:00
committed by GitHub
parent 9338aa2497
commit 7ff43d07b2
7 changed files with 36 additions and 17 deletions

View File

@@ -135,6 +135,8 @@ Advanced options:
--cppCompileToNamespace:namespace
use the provided namespace for the generated C++ code,
if no namespace is provided "Nim" will be used
--nimMainPrefix:prefix use `{prefix}NimMain` instead of `NimMain` in the produced
C/C++ code
--expandMacro:MACRO dump every generated AST from MACRO
--expandArc:PROCNAME show how PROCNAME looks like after diverse optimizations
before the final backend phase (mostly ARC/ORC specific)

View File

@@ -246,6 +246,9 @@ Also, C code requires you to specify a forward declaration for functions or
the compiler will assume certain types for the return value and parameters
which will likely make your program crash at runtime.
The name `NimMain` can be influenced via the `--nimMainPrefix:prefix` switch.
Use `--nimMainPrefix:MyLib` and the function to call is named `MyLibNimMain`.
Nim invocation example from C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -385,6 +385,10 @@ of your program.
NimMain() # initialize garbage collector memory, types and stack
The name `NimMain` can be influenced via the `--nimMainPrefix:prefix` switch.
Use `--nimMainPrefix:MyLib` and the function to call is named `MyLibNimMain`.
Cross-compilation for iOS
=========================
@@ -413,6 +417,9 @@ of your program.
Note: XCode's "make clean" gets confused about the generated nim.c files,
so you need to clean those files manually to do a clean build.
The name `NimMain` can be influenced via the `--nimMainPrefix:prefix` switch.
Use `--nimMainPrefix:MyLib` and the function to call is named `MyLibNimMain`.
Cross-compilation for Nintendo Switch
=====================================