digitalmars.D.learn - Building (and including libraries) without dub
- Hasen Judy (10/10) Aug 26 2017 Building simple programs without dub is easy, just pass a list of
- drug (12/23) Aug 26 2017 It's like C++. If you use Linux then:
- Hasen Judy (6/17) Aug 26 2017 Thanks for your response!
- drug (2/20) Aug 26 2017 Yes
- Mike Wey (7/31) Aug 26 2017 You will need an extra `-L` to pass things to the linker with dmd.
- Adam D. Ruppe (3/6) Aug 26 2017 It is also easy, just pass the list of its d source files to the
- Jonathan Marler (8/15) Aug 26 2017 Note that yesterday I pushed a PR to dmd that allows you to
- zabruk70 (4/7) Aug 27 2017 sometimes pragma("lib", ...) very usefull (if i understand you
Building simple programs without dub is easy, just pass a list of .d source files to `dmd` or `ldc2`. What if I want to include a 3rd party library? Surely before dub existed, people were incorporating other libraries in their projects. I want to learn how this works from first principles. I've been working with dynamic/interpreted languages for too long, I forgot what it's like to build native programs without a dependency manager. Any help would be appreciated!
Aug 26 2017
26.08.2017 12:03, Hasen Judy пишет:Building simple programs without dub is easy, just pass a list of .d source files to `dmd` or `ldc2`. What if I want to include a 3rd party library? Surely before dub existed, people were incorporating other libraries in their projects. I want to learn how this works from first principles. I've been working with dynamic/interpreted languages for too long, I forgot what it's like to build native programs without a dependency manager. Any help would be appreciated!It's like C++. If you use Linux then: ``` dmd <list of your .d files like you do> -L/path/to/lib -llibrarynamewithoutlibprefix ``` or example ``` dmd myapp.d -L../otherproject/lib -lcool ``` line above compiles `myapp.d` file and links it with library `libcool` that is place in directory `../otherproject/lib`
Aug 26 2017
On Saturday, 26 August 2017 at 10:02:03 UTC, drug wrote:It's like C++. If you use Linux then: ``` dmd <list of your .d files like you do> -L/path/to/lib -llibrarynamewithoutlibprefix ``` or example ``` dmd myapp.d -L../otherproject/lib -lcool ``` line above compiles `myapp.d` file and links it with library `libcool` that is place in directory `../otherproject/lib`Thanks for your response! So if I may make a guess, when you include a dependency in a dub project, what it ends up doing is compiling the dependency separately into a lib file then statically link the lib with your project?
Aug 26 2017
26.08.2017 13:05, Hasen Judy пишет:On Saturday, 26 August 2017 at 10:02:03 UTC, drug wrote:YesIt's like C++. If you use Linux then: ``` dmd <list of your .d files like you do> -L/path/to/lib -llibrarynamewithoutlibprefix ``` or example ``` dmd myapp.d -L../otherproject/lib -lcool ``` line above compiles `myapp.d` file and links it with library `libcool` that is place in directory `../otherproject/lib`Thanks for your response! So if I may make a guess, when you include a dependency in a dub project, what it ends up doing is compiling the dependency separately into a lib file then statically link the lib with your project?
Aug 26 2017
On 26-08-17 12:02, drug wrote:26.08.2017 12:03, Hasen Judy пишет:You will need an extra `-L` to pass things to the linker with dmd. ``` dmd myapp.d -L-L../otherproject/lib -L-lcool ``` -- Mike WeyBuilding simple programs without dub is easy, just pass a list of .d source files to `dmd` or `ldc2`. What if I want to include a 3rd party library? Surely before dub existed, people were incorporating other libraries in their projects. I want to learn how this works from first principles. I've been working with dynamic/interpreted languages for too long, I forgot what it's like to build native programs without a dependency manager. Any help would be appreciated!It's like C++. If you use Linux then: ``` dmd <list of your .d files like you do> -L/path/to/lib -llibrarynamewithoutlibprefix ``` or example ``` dmd myapp.d -L../otherproject/lib -lcool ``` line above compiles `myapp.d` file and links it with library `libcool` that is place in directory `../otherproject/lib`
Aug 26 2017
On Saturday, 26 August 2017 at 09:03:03 UTC, Hasen Judy wrote:Building simple programs without dub is easy, just pass a list of .d source files to `dmd` or `ldc2`. What if I want to include a 3rd party library?It is also easy, just pass the list of its d source files to the compiler as well. Quite trivial, really.
Aug 26 2017
On Saturday, 26 August 2017 at 12:45:31 UTC, Adam D. Ruppe wrote:On Saturday, 26 August 2017 at 09:03:03 UTC, Hasen Judy wrote:Note that yesterday I pushed a PR to dmd that allows you to import 3rd party libraries without having to list all their d source files on the command line (https://github.com/dlang/dmd/pull/7099). So long as the compiler knows where to find them (using -I<path>), if you specify -ci (compile imports) it will automatically treat all unknown imports as if they were specified on the command line.Building simple programs without dub is easy, just pass a list of .d source files to `dmd` or `ldc2`. What if I want to include a 3rd party library?It is also easy, just pass the list of its d source files to the compiler as well. Quite trivial, really.
Aug 26 2017
On Saturday, 26 August 2017 at 09:03:03 UTC, Hasen Judy wrote:What if I want to include a 3rd party library? Surely before dub existed, people were incorporating other libraries in their projects.sometimes pragma("lib", ...) very usefull (if i understand you correctly) https://dlang.org/spec/pragma.html#lib
Aug 27 2017