lua-users home
lua-l archive

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


On Fri, May 2, 2014 at 7:32 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
Am 03.05.2014 00:40 schröbte Rena:


I just tried this and it wasn't able to find the library or header files
for SDL2-ttf even after I installed libsdl-ttf2.0-dev.
I found the library in /usr/lib/x86_64-linux-gnu/libSDL_ttf-2.0.so.0 and
symlinked it to /usr/local/lib/libSDL2_ttf.so but I wasn't able to find
header files for it at all (only /usr/include/SDL/SDL_ttf.h which I assume
is for SDL 1.x). I gave up there because I rather need text in my
application. I'm using Lubuntu 13.10 on AMD64 and trying to compile for Lua
5.2.

The required package is `libsdl2-ttf-dev` which is in Ubuntu 14.04 but not 13.10. (I upgraded this weak precisely because of this). If you don't want to upgrade just yet, you can try to install the new packages manually via dpkg ...


Philipp




Ah, I'll look into that. Not looking forward to upgrading though. (the auto upgrader has never worked for me, have to do a clean reinstall, and have been wanting to move away from Canonical stuff...)

Also, found a bug in common/common.c, in function commonPush:
commonPushUserdata(L, va_arg(ap, const char *), va_arg(ap, void *));
This can result in the wrong pointers being given, because order of function argument evaluation in C is not defined. I ended up with renderers not having any metatable, because it was getting the wrong pointer for tname, not finding any such metatable, and thus setting nil as the metatable.

I changed it to:
case 'p': {
    const char *name = va_arg(ap, const char *);
    void *ptr = va_arg(ap, void *);
    common_push_userdata(L, name, ptr);
    ++ count;
    break;
}
(the extra {} are needed to be able to declare variables within the scope of that case)

Anywhere else you're using va_arg() more than once in a function call will similarly need to be changed.


--
Sent from my Game Boy.