fredreichbier / ooc-lua

lua binding for ooc
MIT License
8 stars 1 forks source link

ooc-sdl2 generates weird lua stuff #3

Closed nddrylliog closed 10 years ago

nddrylliog commented 10 years ago

See:

local howling = require("howling")
local _module = howling.Module:new("sdl2/OpenGL")
local ffi = require("ffi")

local _imports = {
    "sdk:lang/Abstractions",
    "sdk:lang/Buffer",
    "sdk:lang/BufferIterator",
    "sdk:lang/Character",
    "sdk:lang/Exception",
    "sdk:lang/Format",
    "sdk:lang/IO",
    "sdk:lang/Iterators",
    "sdk:lang/Memory",
    "sdk:lang/Numbers",
    "sdk:lang/String",
    "sdk:lang/stdlib",
    "sdk:lang/types",
    "sdk:lang/VarArgs"
}

local _typesdeclared = false
function _module.declare_types()
    if _typesdeclared then return end
    _typesdeclared = true
    howling.import_types(_imports)

    ffi.cdef[[
    typedef struct ___UInt UInt;

    typedef struct ___UInt UInt;

    typedef struct ___UInt UInt;

    typedef struct ___Int Int;

    typedef struct ___Int Int;

    typedef struct ___UChar UChar;

    typedef struct ___SChar SChar;

    typedef struct ___short short;

    typedef struct ___UChar UChar;

    typedef struct ___UShort UShort;

    typedef struct ___ULong ULong;

    typedef struct ___Float Float;

    typedef struct ___Float Float;

    typedef struct ___Double Double;

    typedef struct ___Double Double;

    typedef struct ___Void Void;

    typedef struct ___LLong LLong;

    typedef struct ___ULLong ULLong;

    typedef struct ___UShort UShort;

    typedef struct ___Char Char;

    typedef struct ___UInt UInt;

    typedef struct ___Char Char;

    typedef struct ___ptrdiff_t ptrdiff_t;

    typedef struct ___ptrdiff_t ptrdiff_t;

    typedef struct ___ptrdiff_t ptrdiff_t;

    typedef struct ___ptrdiff_t ptrdiff_t;

    ]]
end

local _funcsdeclared = false
function _module.declare_and_bind_funcs()
    if _funcsdeclared then return end
    _funcsdeclared = true
    howling.import_funcs(_imports)

    ffi.cdef[[
    ]]

end

return _module

I'm not an expert, but those struct look suspicious. Also then lua complains about 'short' being typedef'd to.

nddrylliog commented 10 years ago

In fact that's a rock issue - migrated to https://github.com/nddrylliog/rock/issues/769