#pragma comment (lib, ...)

Paulo Pinto pjmlp at progtools.org
Wed Oct 10 10:47:21 PDT 2012

On Wednesday, 10 October 2012 at 16:18:10 UTC, Manu wrote:
> On 10 October 2012 16:45, Paulo Pinto <pjmlp at progtools.org> 
> wrote:
>> This only works if it is part of the language definition.
>> In C and C++ case I am usually against it, because I favour 
>> portability
>> over dependencies to a specific compiler vendor. Many years of 
>> writing
>> multi-platform code do leave some scars.
> Errr, what? This enhanced portability, that's the point.
> I've spent my career writing more cross-platform code than most 
> coders
> would touch in their lives, and I give thanks for the platforms 
> where it is
> available.
> It always leads to a vastly simplified path in the build 
> scripts for those
> platforms that support it, and typically produces more reliable 
> and
> less fickle results; ie, I never experience link problems with 
> those
> platforms.

I never state you did not. Actually since I know you do games 
development I suspect exactly that, that you are also aware of 
such issues.

> Multi-platform code always has #ifdef guards around #pragma
> comment(lib,)-ing the appropriate libs for the platform which 
> the code is
> being built for, and that is the whole point. The code its self 
> selects the
> libs it depends on by simply being compiled.

I tend to push for platform specific code to have their own set 
of files, thus
minimizing preprocessor usage.

I rather have a interface.h file with corresponding 
interface_osname.cpp files.

As I mentioned in other threads, when you work with cheap 
developers the code tends to be scary, so minimizing preprocessor 
usage is a GOOD thing.

> As for D, if this can be made part of the language then I see 
> no big reason
>> against it.
> Well, DMD says it is ;) .. Question is, is it technically 
> possible for
> other compilers to support it?

You right here, I failed to look up the language definition.


More information about the Digitalmars-d mailing list