Compiling and linking libraries

Edwin van Leeuwen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 16 06:59:40 PST 2016


On Wednesday, 16 November 2016 at 14:27:41 UTC, Darren wrote:
> Hey all,
>
> This is a very beginner problem, but not one I know how to do 
> on my own.  Could anyone give a step-by-step guide on how to 
> compile libraries, and then use them in my project with DUB?

If you are happy to use dub I would just add the GL library as a 
dependency to my dub.json file. Then if you call dub it will 
download and compile the necessary file.

Example dub.json file:
```
{
	"name": "myWindow",
	"authors": [
		"Darren"
	],
	"description": "A minimal D application.",
	"copyright": "Copyright © 2016, Darren",
         "dependencies": {
                 "derelict-gl3": "~>2.0.0-alpha.2"
         }
}
```

This will build the necessary library into your library though, 
so it is not the same as using a static library.

Also see the "Creating an own project" section on 
https://code.dlang.org/getting_started


More information about the Digitalmars-d-learn mailing list