Interop with C in Clojure
2
with panama
netpyoung@gmail.com
September 2019
#1
Do you have any Questions?
- for keep time, to save each others time
- If you have questions, during presentation.
- message on slack #clojure-sg with page #numer.
- https://clojurians.slack.com/messages/clojure-sg
- ex) #10 - what is blabla?
- I will answer after presentation.
- so, I can polish this slide from your feedbacks.
#2
● EunPyoung Kim
● KOR -> JPN -> SGP
● Game Client Programmer. (since 2012.04 ~ )
● I like Lisp (not only clojure)
● I’m Lazy
○ because of that I like automatation (code generate also)
○ I like macro (but don't abuse)
● I like Emacs
○ Cursive
○ (Neo)Vim….?
● https://netpyoung.github.io/
#3
What I want & What I did.
● I want to trying use SDL library via clojure
● I made some examples for c binding.
● I want to share approach and experience.
#4
Problem?
● How to load library.
● Writing wrapper function.
● C structure layout for pointer access.
#5
Java & C Binding
● performance check
○ https://github.com/yulewei/java-ffi-demo
● JNI > JNR > JNA (Direct Mapping) > JNA (Interface Mapping)
name date
JNI 1997.02
JNA 2007.03
JNR 2013.02
JavaCPP 2015.07
Panama EAB
#6
Panama
● https://openjdk.java.net/projects/panama/
● Panama: A Foreign Policy for Java by Maurizio Cimadamore
● Going Meta to Valhalla & Panama with John Rose
#7
Panama Example
● Demo
#8
SDL
● Simple DirectMedia Layer
● cross-platform development library.
● designed to provide low level access to audio, keyboard, mouse, joystick, and
graphics hardware via OpenGL and Direct3D
#9
SDL Language Bindings
● https://www.libsdl.org/languages.php
● Ada
● C#
● D
● Go
● Lua
● OCaml
● Pascal
● Python
● Rust
#10
Java SDL Binding?
● https://github.com/javasdl/libjavasdl
● using JNA
#11
Common Lisp SDL Binding?
#12
Clojure SDL Binding?
#13
Demo Clojure binding for SDL2
#14
Questions
ex) #10 - what is blabla?
#15
Thank you

Clojure with panama

  • 1.
    Interop with Cin Clojure 2 with panama netpyoung@gmail.com September 2019 #1
  • 2.
    Do you haveany Questions? - for keep time, to save each others time - If you have questions, during presentation. - message on slack #clojure-sg with page #numer. - https://clojurians.slack.com/messages/clojure-sg - ex) #10 - what is blabla? - I will answer after presentation. - so, I can polish this slide from your feedbacks. #2
  • 3.
    ● EunPyoung Kim ●KOR -> JPN -> SGP ● Game Client Programmer. (since 2012.04 ~ ) ● I like Lisp (not only clojure) ● I’m Lazy ○ because of that I like automatation (code generate also) ○ I like macro (but don't abuse) ● I like Emacs ○ Cursive ○ (Neo)Vim….? ● https://netpyoung.github.io/ #3
  • 4.
    What I want& What I did. ● I want to trying use SDL library via clojure ● I made some examples for c binding. ● I want to share approach and experience. #4
  • 5.
    Problem? ● How toload library. ● Writing wrapper function. ● C structure layout for pointer access. #5
  • 6.
    Java & CBinding ● performance check ○ https://github.com/yulewei/java-ffi-demo ● JNI > JNR > JNA (Direct Mapping) > JNA (Interface Mapping) name date JNI 1997.02 JNA 2007.03 JNR 2013.02 JavaCPP 2015.07 Panama EAB #6
  • 7.
    Panama ● https://openjdk.java.net/projects/panama/ ● Panama:A Foreign Policy for Java by Maurizio Cimadamore ● Going Meta to Valhalla & Panama with John Rose #7
  • 8.
  • 9.
    SDL ● Simple DirectMediaLayer ● cross-platform development library. ● designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D #9
  • 10.
    SDL Language Bindings ●https://www.libsdl.org/languages.php ● Ada ● C# ● D ● Go ● Lua ● OCaml ● Pascal ● Python ● Rust #10
  • 11.
    Java SDL Binding? ●https://github.com/javasdl/libjavasdl ● using JNA #11
  • 12.
    Common Lisp SDLBinding? #12
  • 13.
  • 14.
  • 15.
    Questions ex) #10 -what is blabla? #15
  • 16.