Re: Interested in lua2exe ?

  • From: QuentinC <webmaster@xxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 19 Jul 2012 15:06:13 +0200

@Oliver :
Well, hooking LoadLibrary is just overcomplicated just to work around, and as I have understood, that's essentially a technique used by trojans. IT's simpler to recompile them so that they link with the right DLL and voilà.

The goal is to make something easy to use and simply working out of the box as much as possible. Going into that may also break portability. Allthough lua2exe isn't portable yet, I think it could be if someone bring the missing parts (which is currently very small in fact, just a single function for now, in theory).

@Pansz :
> require"xxxyyy" works if _G.package.loaded.xxxyyy is a module. so If I link a module staticly into the host program, I call luaopen_xxxyyy(); after luaL_openlibs(L); then the module variable is automatically assigned to _G.package.loaded.xxxyyy. this works for me.

Yes. A better approach I think is to put the luaopen_XXX lua C function into packages.preload table, so that the loading is made only when the library is actually required (it may not be always the case).

You could rather easily do that if you take the lua2exe source code, modify lua.c so that the luaopen_XXX function is registered (max. 3-5 lines), and recompile the new version so that luajit and all your other 3rd DLLS are statically linked.

That's a very first version, certainly much improvable, and very simple at the moment :
Here is a download link :
Win32 binary:
Source code:

Other related posts: