Including C sources in a DUB project

H. S. Teoh hsteoh at quickfur.ath.cx
Thu May 5 16:23:18 UTC 2022


On Thu, May 05, 2022 at 06:05:55AM +0000, Alexander Zhirov via Digitalmars-d-learn wrote:
> I'm sure there is such a topic on the forum, but after scrolling
> through the search, I didn't find anything. The bottom line is that I
> want to enable compilation of C sources in DUB and then build the
> project with the connection of libraries. I would like to see an
> example of such a `dub.json` project.
> 
> Enable libraries (flags) `-lm`, `-lX11`, `-lXrandr`.

I don't know how to do it using dub, but you could use pragma(lib) in
one (or more) of your source files as a workaround:

	pragma(lib, "m");
	pragma(lib, "X11");
	pragma(lib, "Xrandr");


T

-- 
MACINTOSH: Most Applications Crash, If Not, The Operating System Hangs


More information about the Digitalmars-d-learn mailing list