LUA Scripting - Dynamic Loading lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- wagenheimer · 2011-01-14 00:17 I'm trying to Dinamic Load LUA in MAC-OS. liblua5.1.dylib Code: [Select]LuaHandle:= DynLibs.LoadLibrary(ALibName);   if LuaHandle = NilHandle then   begin      Result := False;      Exit;   end; LuaHandle is always returning NilHandle. FileExists(ALibName) returns true. I use the same command to load Bass (libbass.dylib) and it works. Anybody have any idea of what is wrong? ---------------------------------------------------------------------- Phil · 2011-01-14 00:36 Are you specifying the complete path to it? What is the path? Thanks. -Phil ---------------------------------------------------------------------- wagenheimer · 2011-01-14 00:50 Yes I am. FileExists(ALibName) is returning True. There is the Lua.Pas and the liblua5.1.dylib that I'm using. http://wagenheimer.com/temp/liblua5.1.dylib http://wagenheimer.com/temp/Lua.pas I use this same Lua.Pas in Windows and it works. Please, if you can take a look would be very grateful. ---------------------------------------------------------------------- Phil · 2011-01-14 00:56 No, I meant what's the path to the library? Try doing ExpandFileName to make sure it's a full path and not a relative path. From Lua.pas:     ALibName:= ExtractFilePath( ParamStr(0) ) + DefaultLibName; That's probably giving you a relative path on OS X. Thanks. -Phil ---------------------------------------------------------------------- wagenheimer · 2011-01-14 01:08 Thanks for the reply, Well... I have changed it to Code: [Select]ALibName:=  ExpandFileName(GetCurrentDir() + '/'+DefaultLibName); The ALibName value is '/Developer/Games/Phoenix/demos.freepascal/_Compiled/liblua5.1.dylib' And the .dylib really exists in this path, but it still does not works. What else should I verify? I will make a project to you test it. Thanks ---------------------------------------------------------------------- Phil · 2011-01-14 02:08 Where did you obtain liblua5.1.dylib? Or did you build it yourself? Make sure it's not dependent on other libraries that you don't have: otool -L liblua5.1.dylib And compatible with your machine (Intel or PowerPC): file liblua5.1.dylib Thanks. -Phil