Building static libs with -o-

John Colvin via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Thu Apr 2 14:57:14 PDT 2015


On Thursday, 2 April 2015 at 16:24:49 UTC, Jeremy DeHaan wrote:
> On Thursday, 2 April 2015 at 15:34:39 UTC, John Colvin wrote:
>> On Thursday, 2 April 2015 at 06:30:36 UTC, Jeremy DeHaan wrote:
>>> I started playing around with ldc v 0.15.1 on Linux, and when 
>>> building static libraries I noticed that it still produced 
>>> object files. I don't need object files for what I am doing, 
>>> so I tried to use the -o- switch and just get the static 
>>> libraries. Unfortunately, this causes no static library files 
>>> to be produced either. Is this supposed to be the case or did 
>>> I do something wrong?
>>
>> -od lets you choose where those object files are put
>>
>> ldc2 -od=obj_files myFile.d myOtherFile.d && rm -r obj_files
>>
>> -singleobj puts everything in one object file, which can 
>> sometimes mean faster executables and also makes it easier to 
>> find and delete.
>
> Yeah, that is the route that I ended up going.
>
> You say -singleobj can sometimes mean faster executables. In 
> what cases?

There are inlining opportunities across modules that only exist 
when they are compiled together. Even if you feed all the modules 
to LDC at once, the backend only sees one at once. Or at least 
that's what I understand, perhaps one of the LDC devs can correct 
me if I'm wrong.


More information about the digitalmars-d-ldc mailing list