Hi,

I am investigating whether or not nim can be used to rewrite an existing C++ library to nim. Ideally I want to do the conversion per C++ class and produces an object file which I add to a static library and can test.

Example (vector.nim)

type Vector = ref object of RootObj
  x: float
  y: float
So using nim, produces an object file vector.o in nimcache. Ideally I want to specify where to put the object file via the -o option, but that does not work
$ nim c --noMain --noLinking  vector.nim
The purpose of all of this, I have written a sort of compiler (actually transpiler written in Crystal) which takes my language and transpiles it to C++ which will be linked with my C++ shared library but parts of the library are written by others (open source) but are a mess and difficult to rewrite in C++. Perhaps nim could be of some help here.

Version nim: Nim Compiler Version 0.18.0 [Linux: amd64] Copyright (c) 2006-2018 by Andreas Rumpf

git hash: 855956bf617f68ac0be3717329e9e1181e5dc0c6

2018-04-14 22:29:52
Invoking the Nim compiler for single files with --noMain --noLinking will not work well. Instead let the compiler do its job and invoke it for a full Nim project.
2018-04-14 22:53:15