diff --git a/Source/script/simba.script_pluginloader.pas b/Source/script/simba.script_pluginloader.pas index ee747842d..504ab02a3 100644 --- a/Source/script/simba.script_pluginloader.pas +++ b/Source/script/simba.script_pluginloader.pas @@ -12,13 +12,22 @@ function LoadPlugin(FileName: String; ExtraSearchDirs: TStringArray = nil): TLib implementation uses - simba.mufasatypes, simba.env; + simba.mufasatypes, simba.env + {$IFDEF UNIX}, + dl + {$ENDIF}; function LoadPlugin(FileName: String; ExtraSearchDirs: TStringArray): TLibHandle; begin if (not FindPlugin(FileName, ExtraSearchDirs)) then raise Exception.CreateFmt('Unable to find plugin "%s"', [FileName]); + {$IFDEF UNIX} + Result := TLibHandle(dlopen(PChar(FileName), RTLD_NOLOAD)); + if (Result <> NilHandle) then + Exit; + {$ENDIF} + Result := LoadLibrary(FileName); if (Result = NilHandle) then