On 18 Jul 2011, at 10:03, ik wrote:

> Let's say that I write the following code:
> 
> program say_hello;
> 
> begin
>  writeln('Hello');
> end.
> 
> program say_helloworld;
> 
> begin
>  writeln('Hello World');
> end.
> 
> They both have the same size and the same memory footprint.
> So what exactly is going on ?

Alignment/rounding of section sizes.

> Why does Pascal compiler generate static
> linked executable while C/++ compiler will generate dynamic executable ?
> 
> What are the benefits in this approach and what are the bad things with it ?

With static linking, you can copy the program to other systems and it will 
normally just work. With dynamic linking, the target systems needs a version of 
the same dynamic library (or a compatible version for the program to run. The 
advantage of dynamic linking is that shared libraries can be loaded in memory 
just once, and then the same copy of the library can be used by all programs 
that link to it (with copy-on-write for writable sections of the data, so that 
programs won't influence each other when writing).

FPC's rtl interface is not very stable, so using a shared library approach 
would probably cause lots of compatibility problems (or require the 
installation of many different version of the FPC rtl shared library, with most 
programs using a different version). The interface of libstdc++ changes less 
often.


Jonas_______________________________________________
fpc-pascal maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to