View mode: basic / threaded / horizontal-split · Log in · Help
November 18, 2010
linking custom modules (dmd)
Hello,

I haven't found the way to have custom modules linked by dmd like stdlib ones. For instance, if program P imports modules M and std.string, I need to manually write a build command like:
	$ dmd -w -ofP P.d M.d
What have I missed?

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com
November 18, 2010
Re: linking custom modules (dmd)
On 11/18/2010 7:34 PM, spir wrote:
> Hello,
>
> I haven't found the way to have custom modules linked by dmd like stdlib ones. For instance, if program P imports modules M and std.string, I need to manually write a build command like:
> 	$ dmd -w -ofP P.d M.d
> What have I missed?

Nothing. DMD automatically links with Phobos.lib when you compile your 
app. But it does not automatically compile and link any non-Phobos 
modules you import unless you explicitly pass them on the command line, 
as you have done. There's a tool that ships with dmd, called rdmd, that 
will do what you want if you use it in place of dmd.
November 18, 2010
Re: linking custom modules (dmd)
On Thu, 18 Nov 2010 05:34:39 -0500, spir <denis.spir@gmail.com> wrote:

> Hello,
>
> I haven't found the way to have custom modules linked by dmd like stdlib  
> ones. For instance, if program P imports modules M and std.string, I  
> need to manually write a build command like:
> 	$ dmd -w -ofP P.d M.d
> What have I missed?

http://www.digitalmars.com/d/2.0/dmd-linux.html#dmd_conf

Add stuff to this file if you want dmd to automatically link your libs.

-Steve
November 18, 2010
Re: linking custom modules (dmd)
Mike Parker Wrote:

> Nothing. DMD automatically links with Phobos.lib when you compile your 
> app.

Well, not really automatic, the dmd.conf/sc.ini file is read by dmd, and can be edited for other libraries/files/commands.
November 18, 2010
Re: linking custom modules (dmd)
On Thu, 18 Nov 2010 20:01:00 +0900
Mike Parker <aldacron@gmail.com> wrote:

> On 11/18/2010 7:34 PM, spir wrote:
> > Hello,
> >
> > I haven't found the way to have custom modules linked by dmd like stdlib ones. For instance, if program P imports modules M and std.string, I need to manually write a build command like:
> > 	$ dmd -w -ofP P.d M.d
> > What have I missed?
> 
> Nothing. DMD automatically links with Phobos.lib when you compile your 
> app. But it does not automatically compile and link any non-Phobos 
> modules you import unless you explicitly pass them on the command line, 
> as you have done. There's a tool that ships with dmd, called rdmd, that 
> will do what you want if you use it in place of dmd.

Thank you all, now I understand. I will not modify dmd.conf, as imported modules change for every app. But try rdmd when I have for that.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com
Top | Discussion index | About this forum | D home