[fpc-pascal] Shared libries

Torsten Bonde Christiansen tc at epidata.dk
Mon Dec 12 08:12:53 CET 2011


On 2011-12-12 00:48, noreply at z505.com wrote:
>
>> Ok, thanks for clearifying that. I guess it's going to be a lot of
>> include files instead... :)
>>
>> -Torsten.
>
>
> Why do you need include files in your case?
> You can put the units in the uses clause of your library.
Because it is still going to give me a very long list of exports - 
considering I have approx. 200 methods to export.

Instead I would do something like this:

library something;

{$DEFINE InterfaceSection}
{$I unit1}
[snip...]
{$I unit20}
{$UNDEFINE InterfaceSection}

exports
{$DEFINE ExportSection}
{$I unit1},
[snip...]
{$I unit20}
{$UNDEFINE ExportSection}
;

end.

unit 1;

{$IFDEF InterfaceSection}
function Foo(a: integer): integer;
begin
   result := a * a;
end;
{$ENDIF}

{$IFDEF ExportSection}
   Foo name 'Bar'
{$ENDIF}





More information about the fpc-pascal mailing list