Skip to content

Odin bindings #21

Open
Open

Description

@Coded-Eye

What would you like?

I've made odin bindings at Coded-Eye/BUI

It uses odin-c-bindgen to generate the bindings.

Run cmake -S . -B build -DBUI_BUILD_ODIN_BINDINGS=ON && cmake --build build -j 2

It makes a folder inside of build/bindings/odin/ called BUI that users can vendor in since there is no package manager inside of odin.

I have tested it and it seems to work fine.

What would you use it for?

I like to use odin rather than C

Activity

  1. added
    enhancement
    on Nov 8, 2026
  2. ppmpreetham commented on Nov 8, 2026

    @ppmpreetham
    Owner

    YOOO Thank you very much!

    • Odin is one of the top five languages people have asked to provide bindings for BUI.
    • Once it's tested in all 3 OSes (Linux, Windows, MacOS), we can merge it!!

    Join Discord to find people who'll test for other OSes / Other updates!

    Image
  3. ppmpreetham commented on Nov 8, 2026

    @ppmpreetham
    Owner

    I've looked into your repo, and it looks clean and well structured.
    I'll soon test it on Windows!

  4. Coded-Eye commented on Nov 8, 2026

    @Coded-Eye
    Author

    I am pretty sure It won't work on windows since I completely forgot about it. Will add it in an hour.

  5. Coded-Eye commented on Nov 8, 2026

    @Coded-Eye
    Author

    Added windows support. you can test it.

    I don't work on windows at all. so tell me if there is anything that needs fixing.

  6. ppmpreetham commented on Nov 9, 2026

    @ppmpreetham
    Owner

    Thank you very much!
    I'll test the Odin bindings for windows.

  7. ppmpreetham commented on Nov 9, 2026

    @ppmpreetham
    Owner

    Thanks a lot for the Odin bindings, and for adding Windows. I tried them on Windows 11 (Odin dev-2026-11-nightly, CMake 3.31, VS 2019 Build Tools, -DBUI_BUILD_ODIN_BINDINGS=ON). Configure works, but the build stops when bindgen runs:

    BUI_kit.h(17,10): error: 'GPU_raster.h' file not found
    BUI_kit.h(325,35): unknown type name 'uint32_t'
    unknown type name 'BuiRaster'
    

    Only BUI_kit.h is copied into the build folder, and it includes GPU_raster.h. When I copied GPU_raster.h next to it by hand, bindgen worked and produced the .lib files and BUI_kit.odin. So could you stage the headers it includes too (or pass the include directories to bindgen)?

    After that, a small test program that only calls BK_version_string() and BK_window_supported() failed to link for me with:

    MSVCRTD.lib(_setjmp.obj): not enough bytes to parse .drectve
    

    I can't tell if that is my old VS 2019, the hardcoded debug runtime libs, or the Odin nightly. A few things in the Windows link list might be related, so could you look at:

    • The list has user32, gdi32 and so on, but not imm32.lib, which BUI needs now (IME).
    • msvcprtd / vcruntimed / ucrtd are hardcoded, so Release builds won't match them.
    • The Windows branch assumes the MSVC layout (gpu/<config>/bui_gpu.lib). MinGW builds make libbui_gpu.a with no config folder, so those fail. If MinGW isn't supported, a clear message in CMake is fine.

    Before I can merge:

    • Could libclang.dll / libclang be found at configure time (LLVM install or find_program) instead of being committed? If that isn't possible, tell me why.
    • Please pin odin-c-bindgen to a specific version.
    • BUI_BUILD_ODIN_BINDINGS needs an option() in the root CMakeLists.txt, so it shows in the options table.
    • Please add a small test that links the bindings and calls BK_version_string(), plus a CHANGELOG entry and a short docs page (docs; see AGENTS.md).

    If you can reproduce this on VS 2019, I'll test again. Thanks again!

  8. Coded-Eye commented on Nov 9, 2026

    @Coded-Eye
    Author

    Still testing GPU_raster.h due to odin-c-bindgen weird behavior when I include it for some reason the resulting GUI_raster.odin is broken. So I haven't pushed it yet.

    The build do not stop even if it's not included. The red lines just shows that some types do not have definitions and shouldn't affect anything at all, default odin-c-bindgen behavior.

    The whole windows side was just thrown together in an hour because I had prior engagement. I will fix everything in a few days. My unfamiliarity with CMAKE and windows is making it all the more difficult

    libclang files it's just there temporarily for testing purposes because I completely didn't know that existed. I just don't use CMAKE at all. Once in a blue moon kind of deal.

    Someone better at CMAKE and windows should take the reigns. It's really not that complicated to use the odin-c-bindgen to make the bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions