[fpc-devel] Linux loadlibrary vs Windows

Michael Van Canneyt michael at freepascal.org
Sun May 14 00:39:59 CEST 2006



On Sat, 13 May 2006, Tony Maro wrote:

> I use the Synapse TCP toolkit.  I recently updated to 2.0.2 (can't get a
> full working 2.0.3 in Windows yet for some reason) and found that
> Synapse suddenly didn't compile in Linux.
> 
> Now, it's likely that the Synapse toolkit has already been updated, but
> my point is the difference now between Linux and Windows.  Previously
> the same code worked, but now you have to remove the pointer(*) typecast
> from Linux, but it still had to be there for Windows.
> 
> Was this intentional?  Both compilers (Linux and Win32) are running
> 2.0.2 now.
> 
> Here's what I had to do to the Synapse toolkit:
> 
> function FreeLibrary(Module: HMODULE): LongBool;
> begin
>   {$ifdef linux}
>   Result := dynlibs.UnloadLibrary(Module);
>   {$else}
>   Result := dynlibs.UnloadLibrary(pointer(Module));
>   {$endif}
> end;
> 
> function GetProcAddress(Module: HMODULE; Proc: PChar): Pointer;
> begin
>   {$ifdef linux}
>   Result := dynlibs.GetProcedureAddress(Module, Proc);
>   {$else}
>   Result := dynlibs.GetProcedureAddress(pointer(Module), Proc);
>   {$endif}
> end;          

AFAIK this has been fixed in the Synapse toolkit. 
It has been changed to use the agnostic TLibHandle type.

Michael.



More information about the fpc-devel mailing list