Visual D: Settings to Improve compil and link process
ParticlePerter via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 9 05:40:51 PDT 2014
On Monday, 7 July 2014 at 22:00:51 UTC, Rainer Schuetze wrote:
>
>
> On 07.07.2014 12:46, ParticlePeter wrote:
>> On Sunday, 6 July 2014 at 19:27:38 UTC, Rainer Schuetze wrote:
>>
>>> These object files are in the library ;-) That means manual
>>> selection,
>>> though, as incremental builds to multiple object files don't
>>> work with
>>> dmd, and single file compilation is painfully slow.
>>
>> Not sure if I am getting this right, so when one object file
>> has to be
>> recompiled all other object files, even if up to date, would be
>> recompiled ?
>
> That's how it is currently done if you don't use "single file
> compilation". Compiling only modified and dependent modules in
> one step could work incrementally, but especially template
> instantiations make this hard to do correctly.
>
>>
>>>> The modules form MyProject do import the MyLib modules
>>>> properly, I do
>>>> not get compiler errors. However, the compiler should create
>>>> Object
>>>> files from MyLib modules, and the linker should link them.
>>>> But he
>>>> does not.
>>>> On the other hand, when I add MyLib modules to MyProject (
>>>> Rightclick
>>>> MyProject - add - existing item... MyLib source files ) then
>>>> linking
>>>> works. I do not understand why the later step is necessary.
>>>
>>> dmd does not compile imported modules, but rdmd does.
>>
>> Ähm ... not seeing the connection here either, why is this
>> significant ?
>
> dmd just compiles the files given on the command line. rdmd
> makes two passes, one to collect imported files, and another to
> compile all the collected files. So rdmd works the way you want
> dmd to work (if I understand you correctly).
>
>> I feel that I could not explain my problem properly, so one
>> example:
>> Importing phobos modules. I do not have to define any import
>> path or lib
>> file in the project settings, I just need to import
>> std.somthing. That's
>> because the import path for phobos modules are stored in the
>> dmd sc.ini
>> file.
>> When I want to import my modules which are somewhere on my
>> hard-drive
>> and not added to my project I need to tell the compiler where
>> these
>> modules can be found, using the additional import path project
>> setting.
>> That's fine, doing this.
>>
>> But result is, std.somthing works, my modules in a path known
>> by the
>> compiler don't work, giving me linker errors. Why ? ( I do not
>> create a
>> lib, I just want to import the module. )
>>
>
> phobos is precompiled to a library and is automatically
> included in the link. If you want your custom modules to work
> the same way, you have to compile them to a library.
Thanks for claryfying all the above. If the std.library is
rebuild whenever a template is used, than my assumption that
MyLib compiles slow due to usage of ( very simple ) templates
must be wrong. I will dive deeper into profiling. Thanks a lot.
Cheers, ParticlePeter
More information about the Digitalmars-d-learn
mailing list