[fpc-pascal] exports VS export

Alex Shishkin alexvins at mail.ru
Tue Jan 18 13:47:35 CET 2011


18.01.2011 15:34, Jonas Maebe пишет:
>
> On 18 Jan 2011, at 13:27, Alex Shishkin wrote:
>
>> what is the difference between "export" proedure/function modifier 
>> and listing this routine in "exports" section?
>
> In theory, they should mean the same.
>
> In practice, FPC currently only actually exports routines that are in 
> the "exports" section of a library, or that are marked as export *and* 
> that have been (re)compiled during the current compilation run (i.e., 
> that were not compiled previous compilation and simply loaded from a 
> .ppu file). See http://bugs.freepascal.org/view.php?id=16070
>
>
> Jonas
>
Following code crashes if disable define use_export_section.

library lib;

{$mode objfpc}{$H+}

uses
Classes
{ you can add units after this };

{$R *.res}

{$define use_export_section}

procedure PrintHello; {$ifndef use_export_section} export; {$endif}
begin
WriteLn('Hello world');
end;

{$ifdef use_export_section}

exports PrintHello;

{$endif}

begin
end.




More information about the fpc-pascal mailing list