[fpc-pascal] fp universal library ?

Fred van Stappen fiens at hotmail.com
Sun Feb 2 12:49:42 CET 2014


> From: hinstance at yandex.ru
> To: fpc-pascal at lists.freepascal.org
> Date: Sun, 2 Feb 2014 15:31:00 +0400
> Subject: Re: [fpc-pascal] fp universal library ?
> 
> 
> 
> 02.02.2014, 02:45, "Fred van Stappen" <fiens at hotmail.com>:
> >> > Yep, thanks Michael.
> >> >
> >> > Hum, may i export dynamic array ?
> >>
> >> No, you'll need to export these as (typed) pointers and a count.
> >>
> >> Regards,
> >> Sven
> >
> > Re-Aaaaargh, ok, (and i understand now why the library-examples are so simple :-) ).
> >
> > Many thanks for that brilliant explanations.
> >
> > Ok, so i have to re-consider all the unit and forget the oop way and re-write more procedural (Yes/No ?).
> 
> I think it should be layered. I tried to visualize the idea; take a look plz
> http://s17.postimg.org/oc24gbc27/Untitled_Diagram.png
> One should not write all units in procedural style to make library accessible from other languages. A better approach is to create API layers. For example to make FPC library accessible from Java and C# consider creating the following layers:
> FPC Library core <-> FPC Library procedural layer
> Procedural layer to Java OO
> Procedural layer to C#
> it should be like first API descends from OO level with FPC objects to procedural layer to make it accessible from java, then there should be java layer which "converts" it back from procedural flattened level to OO level with Java objects.
> 
> AFAIK some libraries are designed like this. 
> To further generalize the idea, consider this scheme:
> Language A OO <-> Language A proc. <-> dynamic lib <-> Language B proc. <-> Language B OO
> 
> So the point is: of course you should NOT rewrite ALL units. Create a procedural bridge instead and then bridges for other languages like I tried to explain
> Of course choosing the right approach for this task it is up to you because no one knows your library better than you

Hello Hinstance and many thanks for advices.

What i will do is, like you said, not try to transform the actual working unit into a library but create a new file ( like the header file in c ) and in uses add the working unit. And that header file will be the "library" file with link to the working unit, with simple function-procedure...

I will give you news later.

Thanks

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140202/15b1c7cc/attachment.html>


More information about the fpc-pascal mailing list