@@ -80,6 +80,7 @@ interface
8080 DynLibs,
8181{ $ELSE}
8282 Posix.DLfcn,
83+ Posix.Pthread,
8384{ $ENDIF}
8485{ $ENDIF}
8586 Classes,
@@ -3363,19 +3364,17 @@ procedure TDynamicDll.OpenDll(const aDllName : string);
33633364 DoOpenDll(aDllName);
33643365
33653366 if not IsHandleValid then begin
3366- { $IFDEF MSWINDOWS}
3367+ { $IFDEF MSWINDOWS}
33673368 s := Format(' Error %d: Could not open Dll "%s"' ,[GetLastError, DllName]);
3368- { $ENDIF}
3369- { $IFDEF LINUX}
3369+ { $ELSE}
33703370 s := Format(' Error: Could not open Dll "%s"' ,[DllName]);
3371- { $ENDIF}
3371+ { $ENDIF}
33723372 if FatalMsgDlg then
3373- { $IFDEF MSWINDOWS}
3373+ { $IFDEF MSWINDOWS}
33743374 MessageBox( GetActiveWindow, PChar(s), ' Error' , MB_TASKMODAL or MB_ICONSTOP );
3375- { $ENDIF}
3376- { $IFDEF LINUX}
3375+ { $ELSE}
33773376 WriteLn(ErrOutput, s);
3378- { $ENDIF}
3377+ { $ENDIF}
33793378
33803379 if FatalAbort then
33813380 Quit;
@@ -3402,8 +3401,16 @@ destructor TDynamicDll.Destroy;
34023401function TDynamicDll.Import (const funcname: AnsiString; canFail : Boolean = True): Pointer;
34033402var
34043403 E : EDllImportError;
3404+ { $IF not Defined(FPC) and not Defined(MSWINDOWS)}
3405+ S : string;
3406+ { $IFEND}
34053407begin
3408+ { $IF Defined(FPC) or Defined(MSWINDOWS)}
34063409 Result := GetProcAddress( FDLLHandle, PAnsiChar(funcname) );
3410+ { $ELSE}
3411+ S := string(funcname);
3412+ Result := GetProcAddress( FDLLHandle, PWideChar(S) );
3413+ { $IFEND}
34073414 if (Result = nil ) and canFail then begin
34083415 { $IFDEF MSWINDOWS}
34093416 E := EDllImportError.CreateFmt(' Error %d: could not map symbol "%s"' , [GetLastError, funcname]);
@@ -3427,8 +3434,7 @@ function TDynamicDll.IsHandleValid : Boolean;
34273434begin
34283435{ $IFDEF MSWINDOWS}
34293436 Result := (FDLLHandle >= 32 );
3430- { $ENDIF}
3431- { $IFDEF LINUX}
3437+ { $ELSE}
34323438 Result := FDLLHandle <> 0 ;
34333439{ $ENDIF}
34343440end ;
@@ -3527,8 +3533,8 @@ procedure TPythonInterface.AfterLoad;
35273533begin
35283534 inherited ;
35293535 FIsPython3000 := Pos(' PYTHON3' , UpperCase(DLLName)) > 0 ;
3530- FMajorVersion := StrToInt(DLLName[7 { $IFDEF LINUX } +3 { $ENDIF} ]);
3531- FMinorVersion := StrToInt(DLLName[8 { $IFDEF LINUX } +4 { $ENDIF} ]);
3536+ FMajorVersion := StrToInt(DLLName[7 { $IFNDEF MSWINDOWS } +3 { $ENDIF} ]);
3537+ FMinorVersion := StrToInt(DLLName[8 { $IFNDEF MSWINDOWS } +4 { $ENDIF} ]);
35323538
35333539
35343540 if FIsPython3000 then
@@ -9743,17 +9749,21 @@ function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
97439749procedure MaskFPUExceptions (ExceptionsMasked : boolean;
97449750 MatchPythonPrecision : Boolean);
97459751begin
9752+ { $IF Defined(CPUX86) or Defined(CPUX64)}
97469753 if ExceptionsMasked then
97479754 SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide,
97489755 exOverflow, exUnderflow, exPrecision])
97499756 else
97509757 SetExceptionMask([exDenormalized, exUnderflow, exPrecision]);
9751- { $IFNDEF NEXTGEN}{ $WARN SYMBOL_PLATFORM OFF}
9758+ { $IFNDEF NEXTGEN}{ $WARN SYMBOL_PLATFORM OFF}
9759+ { $IF Defined(FPC) or Defined(MSWINDOWS)}
97529760 if MatchPythonPrecision then
97539761 SetPrecisionMode(pmDouble)
97549762 else
97559763 SetPrecisionMode(pmExtended);
9756- { $ENDIF !NEXTGEN}{ $WARN SYMBOL_PLATFORM ON}
9764+ { $ENDIF !NEXTGEN}{ $WARN SYMBOL_PLATFORM ON}
9765+ { $IFEND}
9766+ { $IFEND}
97579767end ;
97589768
97599769function CleanString (const s : AnsiString; AppendLF : Boolean) : AnsiString;
0 commit comments