[fpc-pascal]Shared Libraries

Renato Borges A. Prado renato.prado at t-systems.com.br
Fri Aug 29 18:09:23 CEST 2003


I am looking foward into the development of a potentially large project
using FPC, but this project will require the development and dynamic linking
of shared libraries, when looking the site docs, I saw it was not
recommended to make shared libraries with FPC, although the Programmer´s
Manual treat the subject as if it was quite straightfoward... so I got
pretty confused.... any thoughts?

I will need to both create the libraries and link to them at runtime without
knowing them at design time, like the win32 LoadLibrary(filename) function,
but I would need a multiplatform solution...

Any ideas would be welcome.
Renato Borges A. Prado

----- Original Message ----- 
From: "Matt Emson" <memsom at interalpha.co.uk>
To: <fpc-pascal at lists.freepascal.org>
Sent: Friday, August 29, 2003 12:48 PM
Subject: Re: [fpc-pascal]More strangeness...


> > In the development branch THandle is a Cardinal. In the stable 1.0.x
> > branch we left it an Longint. In the past there were some issues in the
> > with Cardinal. At that moment it was decided to leave thandle at
longint.
> > And it has been already a longint for 5 years. When it was really a
> > problem then it would have been noticed much earlier.
>
> Peter, longint is simply wrong. whist is may work in most circumstances,
if
> you are on a system with a lot of handles being allocated, you will get to
> the realms on 32bit unsigned values. As the normal test for a handle
> allocation is :
>
> h := AllocateSomeHandle;
> if (h > 0) then Success
> else Recover;
>
> you are simply asking for trouble. A negative handle value is not
> acceptable. I'm guessing the problems have been got around by the shear
luck
> of a silent cast when passing an longint to a function expecting a
longword.
> However it's possible that L D Blake has stumbled accross somewhere where
> this is not possible.
>
> It's not actually a Cardinal, it's a DWORD that is the normal Win32 type.
> DWORD is mapped to LongWord in Delphi and therefore Cardinal.
>
> Matt
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





More information about the fpc-pascal mailing list