From: John L. <jla...@gm...> - 2006-03-24 01:33:34
|
On 3/23/06, Francesco Montorsi <f18...@ya...> wrote: > Hi, > > John Labenski ha scritto: > > This would be a minimal program with a wxApp:OnInit that creates a > > wxLuaState and runs the string that you provide in minimallua.cpp > > which you generate using bin2c.lua. The file that gets #included and > > the name of the c-string would be hard coded, but bin2c.lua can > > generate files and the c-string they contain with any name, so this is > > easy enough for people. > > > > Big downside - I think that it can only handle a single lua file, > > maybe people can concatenate their files together before running > > bin2c.lua on it? > or we could extend bin2.c to support multiple files writing multiple > > const size_t inputfile_len; > const unsigned char inputfile[] =3D { 123, 232, ... , 0 }; > pieces... Unfortunately won't work if people use dofile(...) or require() since it'll still look for them on disk. > > Out of the box the program would fail to compile since you have to > > provide the lua program c-string in minimallua.cpp. In order to not > > have cvs try to update things I think this would be the best route we > > can take. Alternatively, we put in the minimal.wx.lua and just be > > careful about not overwriting it if any of the developers use it with > > their own programs. > we can also add minimal.wx.lua to CVS and then also to .cvsignore so > that our local copies won't be committed by error... Good idea. > > Any thoughts on this or does someone know how to append data to an exe > > that can be accesed as const char* so > > that a compiler wouldn't be needed? > more or less like Klaas suggest, I think that this can be done simply > copying the original EXE to a new file containing the verbatim EXE + lua > script(s) + payload header concatenated at the end. Then the program > opens 'itself' (i.e. the EXE file on harddisk), using wxFile::Seek it > reads the last bytes of the EXE which are the payload header. This is of > a fixed size and contains just some basic info like the size of the lua > scripts, their name and their order in the EXE. > With these info it's easy for the EXE to do a seek at (filesize - > payload header size - lua script size) and read (lua script size) bytes > in a char[] array.... > > Something like this is done in autopackage using bash and it works very > good ;) Klaas sent me some things about that. I'll try it out this weekend. I think I can write a simple little lua program to automate it. If I can get this to work then back to the original plan. -John |