JanetDocsPlaygroundI'm feeling luckyGitHub sign in

ffi/defbind



    macro
    boot.janet on line 3663, column 3

    (ffi/defbind name ret-type & body)

    Generate bindings for native functions in a convenient manner.


1 exampleSign in to add an example
Loading...
(ffi/context "/usr/lib64/libSDL2.so")

(ffi/defbind SDL_CreateWindow :ptr
    [title :string
     x :int
     y :int
     w :int
     h :int
     flags :uint32])

(ffi/defbind SDL_Delay :void [ms :uint32])
(ffi/defbind SDL_DestroyWindow :void [window :ptr])
(ffi/defbind SDL_Quit :void [])
(def SDL_WINDOW_SHOWN 0x00000004)

(defn main [&]
  (def window (SDL_CreateWindow "Hello world!" 0 0 640 480 SDL_WINDOW_SHOWN))
  (SDL_Delay 4000)
  (SDL_DestroyWindow window)
  (SDL_Quit))
AndriamanitraPlayground