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[] = { 123, 232, ... , 0 };
pieces...
It would reside in
apps/wxluaminimal/src
minimal.cpp - contains subclassed wxApp that runs
minimallua.cpp - user provides this file from bin2c.lua
contains const char* minimallua = {lua program};
sure...
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...
This is the best I think I can do to make it easy to create your own
standalone wxLua executables. It's the closest to pythons freeze that
I can do right now.
Very nice work!
When I briefly looked at freeze I thought that it
was a little beyond the scope of what I want to get involved in.
Unfortunately the creator of their standalone wxLua programs would
need a C++ compiler
Quickly looking at python freeze (http://wiki.python.org/moin/Freeze) I
see that also python devs, need a C++ compiler to create a standalone ELF...
and would have to compile wxLua as well, but
thanks to Francesco that's pretty easy.
;)
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 ;)
Francesco
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wxlua-users mailing list
Wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users