[fpc-pascal] fp universal library ?

Michael Van Canneyt michael at freepascal.org
Sat Feb 1 17:15:58 CET 2014



On Sat, 1 Feb 2014, Fred van Stappen wrote:

> > Date: Sat, 1 Feb 2014 17:00:02 +0100
> > From: michael at freepascal.org
> > To: fpc-pascal at lists.freepascal.org
> > Subject: Re: [fpc-pascal] fp universal library ?
> >
> >
> >
> > On Sat, 1 Feb 2014, Fred van Stappen wrote:
> >
> > > Hello everybody.
> > >
> > > Ok, i jump...
> >
> > [snip]
> >
> > >
> > > Stop compil showing error at dot of function TMyClass.
> > >
> > > => libtest.pas(14,18) Fatal: Syntax error, ":" expected but "." found
> > >
> > > PS : I promise, if i can do the conversion, to create a nice wiki, for dummies like me : "How to create a universal
> > > (complicated) library with fpc"...
> >
> > You cannot export classes from a library. Only regular functions and procedures.
> >
> > Michael.
> 
> Aaaaarg, ok and many thanks to answer.
> 
> >> Only regular functions and procedures.
> 
> Ok but those regular functions and procedures may use other custom classes ?

Not as arguments or result of the function.

How the function is implemented internally is another matter, but you cannot export classes.

You can export pointers, but you should make it so that the caller cannot cast them back to class instances.
That may work for simple cases, but in it's generality it will not work.

If you want to make a generally usable library, restrict your exported interface to pointers and records.

Michael.




More information about the fpc-pascal mailing list