nimble icon indicating copy to clipboard operation
nimble copied to clipboard

[Feature] Allow Dynamic Library Target

Open amaank404 opened this issue 1 year ago • 2 comments

Proposal

To be able to specify in the .nimble file to make a dll instead of exe for certain targets.

example

We have the following nimble script

author = "Anonymous"
version = "1.0.0"
description = ""
license = "MIT"
srcDir = "src"
bin = @["BinaryExecutable"]
dynlib = @["MyDynamicLib"]  # Here
dynlibOptions = "--passL:-static --threads:on" # Command Line Options while building a library.

requires "nim >= 1.6.0"

Now, when we do a nimble build, it would create binary targets as well as dynamic library targets.

Current Status of dynamic library

Currently dynamic libraries are built manually by nim command as follows:

nim c --app:lib --out:MyModule.dll --threads:on --passL:-static src/MyModule.nim

Other proposed features linked to this (but not part of this yet)

  • After this, we can also think about adding support for linking binary executables with dll.

Full Disclosure

I have just started learning nim a day ago and I am not expert enough in nim or c at all.

amaank404 avatar Jul 26 '22 09:07 amaank404

Status: I am currently trying to implement it and so far, I have managed to create the proposed parameters available and are now parsed by the parser. Currently I am stuck on the implementation inside buildFromDir procedure. All the code will be committed to https://github.com/xcodz-dot/nimble as I go.

amaank404 avatar Jul 26 '22 10:07 amaank404

So, I wasn't able to do it and thus will wait for someone skilled to do this later.

amaank404 avatar Jul 26 '22 12:07 amaank404