multiple definition of NimMainInner

2022-03-23 Thread mros
It is the same with this version: $ ../Nim-devel/bin/nim -v Nim Compiler Version 1.7.1 [Linux: amd64] Compiled at 2022-03-23 Copyright (c) 2006-2022 by Andreas Rumpf active boot switches: -d:release Run

multiple definition of NimMainInner

2022-03-23 Thread mros
No, I'm using `1.6.2`: $ nim -v Nim Compiler Version 1.6.2 [Linux: amd64] Compiled at 2021-12-17 Copyright (c) 2006-2021 by Andreas Rumpf git hash: 9084d9bc02bcd983b81a4c76a05f27b9ce2707dd active boot switches: -d:release Run I try the "devel" b

multiple definition of NimMainInner

2022-03-22 Thread mros
I'm using Nim to create multiple static libraries which will be used in a C project. But every static library has it's `*Main*` functions and linking multiple libraries in the same project causes this error: libA.a(@mlibB.nim.c.o): In function `NimMainInner': @mlibB.nim.c:(.text

Return cstringArray from C functions in Nim

2022-03-15 Thread mros
Do you mean something like this: nim impl: proc StringSplit*(): cstringArray {.cdecl, exportc.} = # something here return allocCstringArray(aStringsSeq) proc deallocA*(a: cstringArray) {.cdecl, exportc.} = deallocCStringArray(a) Run and C

Return cstringArray from C functions in Nim

2022-03-14 Thread mros
I want to rewrite a C custom library in Nim to use in C code.

Return cstringArray from C functions in Nim

2022-03-14 Thread mros
I want to rewrite a C functions in Nim. This is the C signature: extern char **StringSplit(char sep, const char *str); Run I wrote this procedure: proc StringSplit*(sep: cchar, str: cstring): cstringArray {.cdecl, exportc.} = # something here

exportc: too many thread local variables

2022-03-10 Thread mros
I'm trying to write a Nim library to use in C code. These are my files: test.nim: import strutils proc NimMain() {.importc.} proc test(p, s: cstring): cint {.cdecl, exportc.} = NimMain() if $p in ($s).split(','): return 1