[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: profiling embedded lua
- From: Geoff Leyland <geoff_leyland@...>
- Date: Wed, 5 Oct 2011 08:54:22 +1300
On 5/10/2011, at 8:23 AM, Oskar Forsslund wrote:
> I am not using luarocks so I won't install from there.
Any reason why not?
> I embed lua by linking to the lua51.lib and having the lua51.dll next to my exe
> I would like to include luatrace somehow in that setup
Shouldn't you only link to one of lua51.lib and lua51.dll? Is this a windows thing? I guess that part works for you so you're doing it right.
Is the end result that you're statically or dynamically linking to Lua? In any case, I've never statically linked the hook to Lua (or anything for that matter), so I couldn't help you there.
> I tried compiling using the makefile in cygwin by commenting out all sections under "guessing target" that didnt create a dll (i.e. forcing it to choose the option that creates a dll)
Exactly which lines did you comment out?
> but I'm not sure I link it correctly to lua. I used the command -L lua51.lib
Where did you get that from? I would have thought -llua51 (as seen in the makefile). But right at the moment this is not your main problem.
> cygwin could run make install with that (ugly) hack and I got a .dll file and put that next to my exe as well.
> I also mimicked the makefile in where to put all lua files from the installation and included them in my project in a lua folder next to my exe
So you have a directory with your .exe and lua51.dll in it, and in that directory, you have a directory named "lua" and inside that there is luatrace.lua and a directory called luatrace? Did you add "lua\?.lua" to package.path and "lua\?.dll" to package.cpath?
Presumably you are managing to run other Lua files? Are they also in the lua folder? Can Lua find them?
> I then tried to include luatrace in my script by require and that didn't work. require couldnt find the specified file (luatrace.lua) and I'm not too surprised since there is none.
Why is there none? Above you said you copied all the lua files to the lua folder. Did you copy luatrace.lua or not?
> TBH I'm just not sure which files to put where and what files I really need to run luatrace with embedded code.
Which is why there's a makefile and a rock.
In your case, where I doubt you'll be using -luatrace on the commandline, you need to copy luatrace.lua, the luatrace directory and the compiled hook (c_hook.dll) into somewhere on package.path or package.cpath. c_hook.dll needs to be in a directory called luatrace.
If you mimicked the makefile, you already did that, right?
> I haven't tried setting luatrace up with my standalone lua installation
Why not? It would be a good idea to check that works first. I don't think your current problems are with luatrace, I think they're to do with working out how to install modules for your "embedded" Lua.