[fpc-devel] Linux loadlibrary vs Windows

Tony Maro tony at maro.net
Sat May 13 23:58:45 CEST 2006


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;          




More information about the fpc-devel mailing list