www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - linking custom modules (dmd)

reply spir <denis.spir gmail.com> writes:
Hello,

I haven't found the way to have custom modules linked by dmd like stdlib on=
es. 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 =E2=98=A3

spir.wikidot.com
Nov 18 2010
next sibling parent reply Mike Parker <aldacron gmail.com> writes:
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.
Nov 18 2010
parent Jesse Phillips <jessekphillips+D gmail.com> writes:
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.
Nov 18 2010
prev sibling next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
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
Nov 18 2010
prev sibling parent spir <denis.spir gmail.com> writes:
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 stdli=


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=20 app. But it does not automatically compile and link any non-Phobos=20 modules you import unless you explicitly pass them on the command line,=20 as you have done. There's a tool that ships with dmd, called rdmd, that=20 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 mo= dules change for every app. But try rdmd when I have for that. Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Nov 18 2010