lua-users home
lua-l archive

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


Nicolas Noble wrote:

Hello Jarrod,

  You need to add the lopcodes.c file from [luadir]/src to your project,
too.

                                                                      God
bless you,


Leandro.


tried that it does not work either :-(
it has to be some problem with the actual visual studio project file
itself since everything compile correctly it just won't link to the
static lib correctly.

This is another issue IMHO. The "missing" symbol is here, but doesn't have
the right name I think. I had this issue before. It is related to the fact
Visual Studio has the baaaaaad habit to mangle C names in the C++ fashion,
and thus sometime generates problems like those. So you may try your luck
a bit with the extern "C" { ... } thingy.

However, I doubt you want the full luac compiler in your project. Maybe
you would even prefer just a function that your main code should call. If
the answer is "yes", then you are just like me :-P

So you might want my "luacomp.c" here:

 http://www.nobis-crew.org/~pixel/luacomp.c

It's a hardcut I made into luac so it now behave as a function, that I
called "luacmain". This "luacmain" will ask for a state, a boolean for
"stripping?", and the usual "chunkwriter" with its companion datas. So,
you have to had load previously a _single_ .lua file, (using lua_load) and
this will dump it to a chunkwriter.

My luacmain function should maybe be changed a bit so that it would
combine() serveral previously lua_load()ed files, for example, in this
manner:

void luacmain(lua_State * L, int stripping, lua_Chunkwriter w, void * uD, int n)
{
   Proto * f;
   int i;
   f = combine(L, n);
   if (stripping)
       strip(L, f);
   luaU_dump(L, f, w, uD);
}

Have fun,

 -- Nicolas Noble


thanks for the link, I will check that out.

I wanted luac to run as a batch process. But the function version will be useful also.

I am compiling everything as "C" code and not "C++" the problem was the lua project was not exporting the symbol because the define is not made anywhere in the lua code, only in print.c from the luac code!!!!! I put the define in the lua project and it builds no problem now !