sonoro1234 / LuaJIT-ImGui

LuaJIT ffi binding for imgui, backends and extension widgets
MIT License
213 stars 29 forks source link

Use non-UDT-1 function wrappers to provide best compatibility with different compilers and original ImGui API #7

Closed THE-FYP closed 5 years ago

THE-FYP commented 5 years ago

This PR changes function generator to wrap non-UDT-1 functions and use them as an original ones. So for example the function

function M.GetMouseDragDelta(button,lock_threshold)
    lock_threshold = lock_threshold or -1.0
    button = button or 0
    return lib.igGetMouseDragDelta(button,lock_threshold)
end

becomes this

function M.GetMouseDragDelta(button,lock_threshold)
    lock_threshold = lock_threshold or -1.0
    button = button or 0
    local nonUDT_out = ffi.new("ImVec2[1]")
    lib.igGetMouseDragDelta_nonUDT(nonUDT_out,button,lock_threshold)
    return nonUDT_out[0]
end

and has the original signature.

This solves the following issues introduced in 96925c96f4953590c5434fa7adbcb3e71fe087ea:

Also since this solves incompatibility between different compilers I guess #5 might be closed.

sonoro1234 commented 5 years ago

All is quite reasonable. Only bothers me that I will never now which happens with all the combinations of compiler and systems (My bet was that this was only affecting to MSVC)

THE-FYP commented 5 years ago

(My bet was that this was only affecting to MSVC)

Nope, Clang too. At least for me on x86/32 windows build.

sonoro1234 commented 5 years ago

Thanks

sonoro1234 commented 5 years ago

But clang comes in to flavors: msvc and gcc (binaries download are msvc compatible)