From da59aa15bc4f42de0268d389a8d7dca1bbf19ee7 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 21 Mar 2009 23:51:48 +0000 Subject: party fix for linux: - plugin-path from UPath used - calling convention must be cdecl for a non-windows os git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1646 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UDLLManager.pas | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/base') diff --git a/src/base/UDLLManager.pas b/src/base/UDLLManager.pas index cd4b7991..9ecee34a 100644 --- a/src/base/UDLLManager.pas +++ b/src/base/UDLLManager.pas @@ -69,8 +69,6 @@ var DLLMan: TDLLMan; const - DLLPath = 'Plugins'; - {$IF Defined(MSWINDOWS)} DLLExt = '.dll'; {$ELSEIF Defined(DARWIN)} @@ -87,6 +85,7 @@ uses {$ELSE} dynlibs, {$ENDIF} + UPath, ULog, SysUtils; @@ -104,7 +103,7 @@ var SR: TSearchRec; begin - if FindFirst(DLLPath +PathDelim+ '*' + DLLExt, faAnyFile , SR) = 0 then + if FindFirst(PluginPath + '*' + DLLExt, faAnyFile , SR) = 0 then begin repeat SetLength(Plugins, Length(Plugins)+1); @@ -174,18 +173,18 @@ begin exit; } //Load Libary - hLibg := LoadLibrary(PChar(DLLPath +PathDelim+ Filename)); + hLibg := LoadLibrary(PChar(PluginPath + Filename)); //If Loaded if (hLibg <> 0) then begin //Load Info Procedure - @Info := GetProcAddress (hLibg, PChar('PluginInfo')); + @Info := GetProcAddress(hLibg, PChar('PluginInfo')); //If Loaded if (@Info <> nil) then begin //Load PluginInfo - Info (Plugins[No]); + Info(Plugins[No]); Result := True; end else @@ -193,22 +192,22 @@ begin FreeLibrary (hLibg); end - else - Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); + else + Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); end; function TDLLMan.LoadPlugin(No: Cardinal): boolean; begin Result := False; //Load Libary - hLib := LoadLibrary(PChar(DLLPath +PathDelim+ PluginPaths[No])); + hLib := LoadLibrary(PChar(PluginPath + PluginPaths[No])); //If Loaded if (hLib <> 0) then begin //Load Info Procedure - @P_Init := GetProcAddress (hLib, PChar('Init')); - @P_Draw := GetProcAddress (hLib, PChar('Draw')); - @P_Finish := GetProcAddress (hLib, PChar('Finish')); + @P_Init := GetProcAddress (hLib, 'Init'); + @P_Draw := GetProcAddress (hLib, 'Draw'); + @P_Finish := GetProcAddress (hLib, 'Finish'); //If Loaded if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then -- cgit v1.2.3