luanet

Posted by Anaristos on Sat 26 Jan 2013 07:26 AM — 13 posts, 41,468 views.

USA #0

require("CLRPackage")

Fails with the following error:
error loading module 'luanet' from file '.\luanet.dll': The specified procedure could not be found.
--
I understand what the error means from the documentation, I just don't see how it applies. I use in both the Lua command line app and in other applications that allow Lua scripting with no problem.
I have to assume from this that things like:
import "System"
will fail for the same reasons. Is there a way around this?
Australia Forum Administrator #1
I'm not familiar with CLRPackage.

However some of the ways that Lua DLLs work together can be problematic.

From my documentation:

Quote:

The error might be "The specified procedure could not be found." if the function is not found in the DLL. You may also get this message if the DLL is dependant on another DLL and some entry points in that other DLL cannot be found. Use a "dependency checker" to see whether all required entry points have been resolved. If you are certain that the entry point that you are requesting exists in the target DLL, then the problem is probably a dependency from the target DLL to another DLL.


You would need a dependency-checker to see what DLLs your DLL relies on. I presume there would be some, and it can be as simple as it depending on lua51.dll but you have lua5.1.dll.
USA #2
I think the problem lies with the package.path. Nowhere it points to lua's clib or even contains \?.dll, so putting the modules in the MUSH folder doesn't work. I tried

module.path = "..."

during the world open event, but either this is not the way to override the default path or the default path cannot be overriden.
USA #3
Sorry, I typed the code in error, it should be:

package.path = "..."
USA #4
I suppose I didn't state my question correctly. What I want to know is how I can modify the package.path so that modules are accessible to my scripts. Putting dlls in the MUSHClient folder doesn't do any good, AFAIK, because searching for \?.dll is not handled. The package.path only allows for \?.lua or \?.luac searches. I tried changing it so that \?.dll could be picked up and those entries were deleted by the client. Entries which I added that were \?.lua remained, however.
Australia Forum Administrator #5
There is a checkbox in the Lua tab of global configuration: "Allow DLLS to be loaded".

What state is that in?
USA #6
The box labeled Allow DLLs to be loaded is checked.
Australia Forum Administrator #7
Anaristos said:

I tried changing it so that \?.dll could be picked up and those entries were deleted by the client. Entries which I added that were \?.lua remained, however.


As far as I know, the client does not delete such entries.
USA #8
When I type print(package.path), the string that shows was put there by an unknown (to me) agent. I didn't even know I had access to the string until I started investigating why my require() requests were failing. When I try to load package.path with the string that I have stored in LUA_CPATH, it ignores it. Further, the string that shows by default contains no \?.dll references at all. I really don't care what the default string is as long as I can change it to suit me. It seems, however, that I cannot.
Australia Forum Administrator #9
What string exactly? When I do this:


print (package.cpath)


I get:


.\?.dll;C:\Program Files\MUSHclient\?.dll;C:\Program Files\MUSHclient\loadall.dll
USA #10
When I enter:

print(package.path)

I get this:

;.\?.lua;C:\MUSHclient\lua\?.lua;C:\MUSHclient\lua\?\init.lua;C:\MUSHclient\?.lua;C:\MUSHclient\?\init.lua;C:\Program Files (x86)\Lua\5.1\lua\?.luac;C:\CMUDPro334P\Aardwolf\Lua\?.lua

It is almost as if it scanned the drives for any folders with <filename>.lua in them and created a path. Though some of the folders don't exit, AFAIK.

EDIT:
OK, I see my mistake. Wrong variable.

print(package.cpath)

yields:

;;C:\Program Files (x86)\Lua\5.1\lua\?.dll;C:\Program Files (x86)\Lua\5.1\lua\?.lua;C:\Program Files (x86)\Lua\5.1\clibs\?.dll;C:\Program Files (x86)\Lua\5.1\clibs\luasql\?.dll;C:\dllcache\?.dll;C:\dllcache\LuaInterface_2.0.3\?.dll

So the place for both LuaInterface.dll and luanet.dll are in the cpath. That makes even less sense because if I run my code in the Lua command app, everything works fine. It also works when I call the code from CMUD, which uses the same LUA_CPATH variable.
Amended on Thu 31 Jan 2013 01:58 AM by Anaristos
Australia Forum Administrator #11
I sticky by reply #1 above. You need to see if any other DLLs are required, which the other DLLs need.
Australia Forum Administrator #12
Let me expand a bit. Lua has gone through some version revisions, and more recently they changed stuff which meant that there was going to be "DLL hell".

The problem that you are having could easily be a side-effect of that. The thing you are trying to run may require different versions of DLLs (or different names) than are offered in the MUSHclient environment.