mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 09:59:40 +02:00

* fix for Mantis #36706: only link a library against the dynamic loader if we're not linking against the C library anyway Note: I did not yet find a case where we *do* need to link a library against the loader; this will have to be investigated further, but for 3.2.0 this is safest ........ * fix for Mantis #36738: when copying a record using its copy operator we assume that we've copied the whole record; this way managed records inside non-managed records are handled correctly + added (adjusted) test ........ * when checking for an existing operator overload for the assignment operator, check for the correct variant (explicit or not) matching the overload + added tests ........ * GetLoadErrorStr (currently) returns a ShortString, so avoid a useless conversion to AnsiString ........ git-svn-id: branches/fixes_3_2@47771 -
79 lines
1.9 KiB
PHP
79 lines
1.9 KiB
PHP
{
|
|
This file is part of the Free Pascal run time library.
|
|
Copyright (c) 1999-2000 by the Free Pascal development team
|
|
|
|
Implements OS dependent part for loading of dynamic libraries.
|
|
|
|
See the file COPYING.FPC, included in this distribution,
|
|
for details about the copyright.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
**********************************************************************}
|
|
|
|
|
|
Function SysLoadLibraryU(const Name : UnicodeString) : TlibHandle;
|
|
|
|
begin
|
|
Result:=WinLoadLibraryW(PWideChar(Name));
|
|
end;
|
|
|
|
Function SysLoadLibraryA(const Name: RawByteString) : TLibHandle;
|
|
|
|
begin
|
|
Result:=WinLoadLibraryW(PWideChar(UnicodeString(Name)));
|
|
end;
|
|
|
|
Function SysGetProcedureAddress(Lib : TLibHandle; const ProcName : AnsiString) : Pointer;
|
|
|
|
begin
|
|
Result:=WinGetProcAddress(Lib,PChar(ProcName));
|
|
end;
|
|
|
|
{$push}
|
|
{$warn 4056 off}
|
|
Function SysGetProcedureAddressOrdinal(Lib : TLibHandle; Ordinal : TOrdinalEntry) : Pointer;
|
|
|
|
begin
|
|
Result:=WinGetProcAddress(Lib,PChar(Ordinal));
|
|
end;
|
|
{$pop}
|
|
|
|
Function SysUnloadLibrary(Lib : TLibHandle) : Boolean;
|
|
|
|
begin
|
|
Result:=WinFreeLibrary(Lib);
|
|
end;
|
|
|
|
Function SysGetLoadErrorStr: string;
|
|
|
|
Var
|
|
rc,c : integer;
|
|
temp: WideString;
|
|
begin
|
|
rc := GetLastError;
|
|
SetLength(temp,255);
|
|
C:=FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM,nil,rc,
|
|
MakeLangId(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
@temp[1], 255,nil);
|
|
SetLength(temp,c);
|
|
Result:=String(temp);
|
|
end;
|
|
|
|
const
|
|
SysDynLibsManager: TDynLibsManager = (
|
|
LoadLibraryU: @SysLoadLibraryU;
|
|
LoadLibraryA: @SysLoadLibraryA;
|
|
GetProcAddress: @SysGetProcedureAddress;
|
|
GetProcAddressOrdinal: @SysGetProcedureAddressOrdinal;
|
|
UnloadLibrary: @SysUnloadLibrary;
|
|
GetLoadErrorStr: @SysGetLoadErrorStr;
|
|
);
|
|
|
|
procedure InitSystemDynLibs;
|
|
begin
|
|
SetDynLibsManager(SysDynLibsManager);
|
|
end;
|