lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'll start by linking to a page with my real name to disassociate myself from a person here mentioned in a rant post I read earlier today [ http://www.comp.dit.ie/aigroup/?page_id=201 ]. I can verify this using whatever method you like.




I took Steve's advice and downloaded a fresh copy of LuaJIT to build it anew to get that lua51.dll and to make sure this is being used instead of the old Lua library. I hid all other lua51.dll files away so the project couldn't know about them. Unfortunately the error persisted. I'm pretty sure that I am linking against that file because when I remove the dll, I get an error message informing me that the program can't find it. 

The good news is that I know I've made a mistake thanks to Mike's post. I used jit.status() and got the error message
"attempt to index global 'jit' (a nil value)"
so now I know that I'm not using JIT (hence there was no change in the benchmarking I did).

I saw this Stack Overflow post [ http://stackoverflow.com/questions/7097930/how-link-obj-files-in-visual-studio ]:
"Use the header file to define LuaJit symbols for your code that deals with Lua. To link you only need the lib and dll. Add the lib file to your link dependencies under Project Properties > Linker > Input. Put the DLL next to your EXE when you run." 

Apologies for being such a noob here. I don't think the build/installation guide mentioned any symbols that I had to add. I think I might have screwed up here. I would like but haven't been able to find a step-by-step with screenshots etc. on a blog. Things like this need to be idiot-proof for me because I'm so bad with linker stuff.



I'm sure that this is a simple mistake I'm making. I'll try to give as much detail as possible.
About my computer and application:
I'm running Windows 7 64-bit with Intel Core 2 Duo T9500. I've created a mod for Half-Life 2 as part of PhD research on automated planning agents. This is a Win32 application that I used Luabind with for Lua. Building the VS2008 solution in release mode that outputs two dll file (server and client) that are used by the game's executable. Normal Lua works fine but I'm trying to implement LuaJIT to see if it has an impact on performance of four algorithms I'm evaluating for a research paper.

1. I downloaded LuaJIT (2 beta8) and put it in some folder.
2. I built the luajit.exe, lua51.dll and lua51.lib. I used "Visual Studio Command Prompt (2010)" (but I've also tried "Windows SDK 7.1 Command Prompt" to create a 32 bit (release) version and a 64 bit LuaJIT version, suspecting this might be the problem).
3. I took the .exe and .dll and put them into a folder my solution could find them in.
4. I create a "lua" folder and a folder in that called "jit" and put all of the .lua files from the luaJIT "lib" folder into the "jit" folder. (I think I'm doing something wrong here. Should the luajit.exe be here?)
5. I put the lua51.lib into a folder somewhere easy to find.
6. In my VS project, I went to "Project Properties/Configuration Properties/Linker/General" and added the path to the folder with my lua51.lib in it.
7. I went into "Project Properties/Configuration Properties/Linker/Input/Additional Dependencies" and added lua51.lib to the list and removed the reference to the old Lua library I had (totally different name).
8. I rebuilt the solution (just in case) and ran the program.
9. Now crash but I get the error message "attempt to index global 'jit' (a nil value)".

Let me know if I'm missing any relevant detail.

Thanks again for the help so far.