Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #104830

Re: How to produce standalone executable using Code::Blocks/Clang ?

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: How to produce standalone executable using Code::Blocks/Clang ?
Date 2017-02-27 10:27 +0100
Organization A noiseless patient Spider
Message-ID <o90rb8$4vp$1@dont-email.me> (permalink)
References <o8u3kk$vs$1@dont-email.me> <o8uloa$l66$1@dont-email.me> <20170227011240.c55a6462c9edd21774c2892e@gmail.com> <o8vtqu$39t$1@dont-email.me> <20170227060545.cac5aa4d4c2a2f9ba593b00d@gmail.com>

Show all headers | View raw


On 27/02/17 06:05, GOTHIER Nathan wrote:
> On Mon, 27 Feb 2017 01:04:17 +0000
> BartC <bc@freeuk.com> wrote:
> 
>> Or, assuming dynamic libraries are loaded on-demand (as happens in my 
>> apps; the loading happens the first time a function in the library is 
>> called), then it could be that 90% of the time, the library is not 
>> needed, or is not needed immediately. But a statically linked executable 
>> would effectively load it anyway and delay start-up. Multiply that by 
>> the number of programs linked like that, and by the number of times they 
>> are loaded.
> 
> Dynamic linking is like mounting your wheels before driving your car whereas
> with static linking your wheels are already mounted to go. Consequently, the
> dynamic linker delay the start-up of your program whatever the size of your
> library.

No, dynamic linking is like driving on a road that you share with
everyone else going in the same direction, rather than every driver
having their own personal road.

> 
> Dynamic loading is different from dynamic linking since it's like mounting your
> wheels when your car moves. As a result, the loader may improve the start-up of
> your program but the late linking process is slowing the execution of the code.
> 

Yes, dynamically linked code will be a little slower than statically
linked code - just like calling functions in a different translation
unit can be a little slower than calling functions in the same
translation unit (since the compiler has less knowledge for
optimisation).  And yet it still makes sense to split projects into
multiple files.

Raw speed is not everything.  Make sensible judgements about where to
make your boundaries, but there are good reasons why people like modular
code.

(In the particular case of libc, a good compiler knows all about the
simple functions in the library and will generate optimised inline code
or statically linked calls for things like strcat, memcpy, etc., to
avoid the overhead).

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to produce standalone executable using Code::Blocks/Clang ? MehdiAmini <atorrses@gmail.com> - 2017-02-26 12:01 +0330
  Re: How to produce standalone executable using Code::Blocks/Clang ? fir <profesor.fir@gmail.com> - 2017-02-26 01:55 -0800
    Re: How to produce standalone executable using Code::Blocks/Clang ? fir <profesor.fir@gmail.com> - 2017-02-26 03:35 -0800
  Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-26 14:40 +0100
    Re: How to produce standalone executable using Code::Blocks/Clang ? BartC <bc@freeuk.com> - 2017-02-26 14:13 +0000
      Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-26 17:26 +0100
        Re: How to produce standalone executable using Code::Blocks/Clang ? BartC <bc@freeuk.com> - 2017-02-26 16:56 +0000
          Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-26 19:00 +0100
            Re: How to produce standalone executable using Code::Blocks/Clang ? scott@slp53.sl.home (Scott Lurndal) - 2017-02-27 15:16 +0000
        Re: How to produce standalone executable using Code::Blocks/Clang ? scott@slp53.sl.home (Scott Lurndal) - 2017-02-27 15:12 +0000
          Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-27 16:43 +0100
    Re: How to produce standalone executable using Code::Blocks/Clang ? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-27 01:12 +0100
      Re: How to produce standalone executable using Code::Blocks/Clang ? BartC <bc@freeuk.com> - 2017-02-27 01:04 +0000
        Re: How to produce standalone executable using Code::Blocks/Clang ? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-27 06:05 +0100
          Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-27 10:27 +0100
            Re: How to produce standalone executable using Code::Blocks/Clang ? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-27 12:21 +0100
              Re: How to produce standalone executable using Code::Blocks/Clang ? BartC <bc@freeuk.com> - 2017-02-27 12:14 +0000
                Re: How to produce standalone executable using Code::Blocks/Clang ? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-27 14:27 +0100
              Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-27 13:55 +0100
      Re: How to produce standalone executable using Code::Blocks/Clang ? Ike Naar <ike@iceland.freeshell.org> - 2017-02-27 08:26 +0000
        Re: How to produce standalone executable using Code::Blocks/Clang ? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-02-27 12:25 +0100
          Re: How to produce standalone executable using Code::Blocks/Clang ? Ike Naar <ike@iceland.freeshell.org> - 2017-02-27 15:24 +0000
      Re: How to produce standalone executable using Code::Blocks/Clang ? David Brown <david.brown@hesbynett.no> - 2017-02-27 10:22 +0100
      Re: How to produce standalone executable using Code::Blocks/Clang ? scott@slp53.sl.home (Scott Lurndal) - 2017-02-27 15:20 +0000
        Re: How to produce standalone executable using Code::Blocks/Clang ? fir <profesor.fir@gmail.com> - 2017-02-27 07:45 -0800
          Re: How to produce standalone executable using Code::Blocks/Clang ? fir <profesor.fir@gmail.com> - 2017-02-27 08:12 -0800
    Re: How to produce standalone executable using Code::Blocks/Clang ? MehdiAmini <atorrses@gmail.com> - 2017-02-27 10:54 +0330

csiph-web