Forum > macOS / Mac OS X
LUA Scripting - Dynamic Loading
wagenheimer:
I'm trying to Dinamic Load LUA in MAC-OS.
liblua5.1.dylib
--- Code: ---LuaHandle:= DynLibs.LoadLibrary(ALibName);
if LuaHandle = NilHandle then
begin
Result := False;
Exit;
end;
--- End code ---
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:
Are you specifying the complete path to it? What is the path?
Thanks.
-Phil
wagenheimer:
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:
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:
Thanks for the reply,
Well... I have changed it to
--- Code: ---ALibName:= ExpandFileName(GetCurrentDir() + '/'+DefaultLibName);
--- End code ---
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
Navigation
[0] Message Index
[#] Next page