On Tue, Mar 26, 2013 at 10:05 AM, Anthony Walter <sys...@gmail.com> wrote: > On Tue, Mar 26, 2013 at 5:57 AM, Marcos Douglas <m...@delfire.net> wrote: >> >> Hi, >> Is possible to make that only using Windows for any lib? >> >> Best regards, >> Marcos Douglas > > > Marcos, > > Are you asking, "Is it possible to build any static lib for Windows and link > it to a free pascal project"?
Yes, that's it. Thank you. > No, not all the time. Libraries may depend on systems function on one > platform which are not available on another. > > But, many times you can if the library can compile with mingw64. When this > is the case you build a C project using mingw64, copy the lib files to a > directory free pascal is using (see environment settings in lazarus), list > the functions in a unit, then put {$linklib youlibname.a} in the > implementation section. You may need a few {$ifdef}s for your different > platforms. I had seen this $linklib but I did not know what it was for. > The benefit of this is that you can easily incorporate (much more easily > rewriting) *complex* functionality into your free pascal projects knowing > what you are reusing is probably faster, has more features, is more robust, > and better tested than a implementation of X that someone reinvented again > for free pascal. > > Sometimes though you might be are better off using dynamic linking (so, dll > on windows) if you know the OS is going to provide features. Examples are > msxml.dll vs libxml2.so, gdiplus.dll vs libcario.so, ect. Of course in these > cases what probably you need to do is write some lite wrappers, since the > apis vary in form (but not function). In those cases I typically use > interfaces... > > IXmlDocument, IXmlNode // for pasring or building Xml > ICanvas, IBrush // for drawing > > and then > > function CreateXmlDocument: IXmlDocument; {$fidef}s > function CreateCanvas: ICanvas; {$fidef}s Good ideas. Thank you for share. Marcos Douglas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal