<div dir="ltr">I just built an FFI Interface for a camera in C++ called from Haskell, it would be nice to see an interface done for C++ with objects. I got it working pretty quickly searching around from other sites, but it would be cool if it was all in one place.<div><br></div><div>Sort of off topic, I had an issue where the main in C++ ran perfectly fine calling into what I believe to be a singleton, but calling from Haskell led to that call freezing every time. If I put the call to the singleton into a static block, it runs fine calling from Haskell. Is this probably the "Static order initialization fiasco"?</div><div><br></div><div>Charlie</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 8, 2014 at 10:54 AM, Alex Petrov <span dir="ltr"><<a href="mailto:oleksandr.petrov@gmail.com" target="_blank">oleksandr.petrov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><span style="font-family:helvetica;font-size:12.85714340209961px">Hi Everyone,</span><div style="font-family:helvetica;font-size:12.85714340209961px"><br></div><div style="font-family:helvetica;font-size:12.85714340209961px">I've recently started working on Haskell FFI Tutorial [1]. The repository already </div><div style="font-family:helvetica;font-size:12.85714340209961px">contains code that explains how to:</div><div style="font-family:helvetica;font-size:12.85714340209961px"><br></div><div style="font-family:helvetica;font-size:12.85714340209961px"><div>  * (expressively) represent C `struct` in Haskell code</div><div>  * call C code from Haskell</div><div>  * call Haskell code from C</div><div>  * operate on nested `struct`s </div><div>  * operate on `struct` arrays</div><div>  * decode `unions` </div><div>  * read and write C fixed-length strings and Pointer-type Strings</div><div>  * how to import functions from, for example, stdlib</div></div><div style="font-family:helvetica;font-size:12.85714340209961px"><br></div><div style="font-family:helvetica;font-size:12.85714340209961px">I'm still working on more story-like writeups, but the first one (about how to call Haskell </div><div style="font-family:helvetica;font-size:12.85714340209961px">from C) is already available [2].</div><div style="font-family:helvetica;font-size:12.85714340209961px"><br></div><div style="font-family:helvetica;font-size:12.85714340209961px">If you have any feedback / comments / questions, know how to improve it or </div><div style="font-family:helvetica;font-size:12.85714340209961px">would like to see more things covered, just ping me. </div><div style="font-family:helvetica;font-size:12.85714340209961px"><br></div><div style="font-family:helvetica;font-size:12.85714340209961px">Thanks</div><div style="font-family:helvetica;font-size:12.85714340209961px"><br></div><div style="font-family:helvetica;font-size:12.85714340209961px">[1] <a href="https://github.com/ifesdjeen/haskell-ffi-tutorial" target="_blank">https://github.com/ifesdjeen/haskell-ffi-tutorial</a></div><div style="font-family:helvetica;font-size:12.85714340209961px">[2] <a href="https://github.com/ifesdjeen/haskell-ffi-tutorial#calling-haskell-from-c" target="_blank">https://github.com/ifesdjeen/haskell-ffi-tutorial#calling-haskell-from-c</a></div></div><span class="HOEnZb"><font color="#888888"><div><span style="font-family:helvetica,arial;font-size:13px"></span><p style="margin:0px"><br></p><p style="margin:0px">-- </p><p style="margin:0px"><br></p><p style="margin:0px">Alex</p><div><a href="https://twitter.com/ifesdjeen" target="_blank">https://twitter.com/ifesdjeen</a><br><div><p style="line-height:normal;font-family:Helvetica,Arial;margin:0px"><a href="http://clojurewerkz.org/" target="_blank">http://clojurewerkz.org/</a></p></div></div></div></font></span></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>