lua-users home
lua-l archive

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


Hi,

I am trying to put together a proof-of-concept program for LuaJIT-FFI
that uses an OpenVG[1] implementation called ShivaVG[2] to render
graphics.

The test uses SDL[3] to handle the window and OpenGL initialization
(ShivaVG's own tests use GLUT, but that requires callbacks).

The problem is that, on Ubuntu 11.04, calling ShivaVG's initialization
function via FFI is consistently causing me an immediate segmentation
fault. The function has a simple signature:

  typedef int VGint;
  typedef enum { VG_FALSE=0, VG_TRUE=1 } VGboolean;

  VGboolean vgCreateContextSH(VGint width, VGint height);

I have an equivalent C program, and that runs fine. I also tried it
(the Lua version) on Windows 7, and it works there too. All the
program actually does, when it works, is present a blank blue window.
Close the window or press Esc to quit.

Here is the code. I have bundled minimal FFI declarations for SDL and
ShivaVG (only the functions/constants I am using) into the one Lua
script:

  Lua: http://pastebin.com/w5FX0eGp
  C:   http://pastebin.com/kExMvhMa

Any help would be much appreciated! I am not much of a Linux expert so
to be honest I wouldn't be surprised if it's something I'm doing
wrong. But I have tried various other experimental FFI bindings with
great success so far.

-Duncan

[1] http://www.khronos.org/openvg/
[2] http://shivavg.sourceforge.net/
[3] http://www.libsdl.org/