# Help: Where to find ffi/examples

**URL:** <https://racket.discourse.group/t/help-where-to-find-ffi-examples/896>\
**Category:** Questions & Answers\
**Tags:** question\
**Created:** [April 19, 2022, 10:17am UTC](https://racket.discourse.group/t/help-where-to-find-ffi-examples/896 "2022-04-19T10:17:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockn](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rockn](https://racket.discourse.group/u/rockn)\
**Post date:** [April 19, 2022, 10:17am UTC](https://racket.discourse.group/t/help-where-to-find-ffi-examples/896/1 "2022-04-19T10:17:19Z")

</div>

Hi, I am learning racket FFI. I want to see more examples. Can someone tell me where to find ffi/examples mentioned in the FFI doc?

---

<div class="post-metadata">

**Author:** ![ryanc](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ryanc/32/71_2.png) [@ryanc](https://racket.discourse.group/u/ryanc)\
**Post date:** [April 19, 2022, 10:51am UTC](https://racket.discourse.group/t/help-where-to-find-ffi-examples/896/2 "2022-04-19T10:51:02Z")

</div>

I recommend using `raco whereis` to find locally-installed things. You can install it with `raco pkg install whereis`. Then:

```
$ raco whereis -c ffi/examples
/path/to/racket-8.4/share/pkgs/racket-doc/ffi/examples

```

The `-c` means find a "collection", which is like a directory of module names. (Some collections, such as `racket`, are spread over multiple physical directories.)

So, it seems to be part of the `racket-doc` package.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [April 19, 2022, 12:19pm UTC](https://racket.discourse.group/t/help-where-to-find-ffi-examples/896/3 "2022-04-19T12:19:30Z")

</div>

The same collection on github:

> **[racket/pkgs/racket-doc/ffi/examples at master · racket/racket](https://github.com/racket/racket/tree/master/pkgs/racket-doc/ffi/examples)**
>
> master/pkgs/racket-doc/ffi/examples

A few extra examples:

> **[ffi-tutorial/ffi/tutorial/examples at master · dyoo/ffi-tutorial](https://github.com/dyoo/ffi-tutorial/tree/master/ffi/tutorial/examples)**
>
> master/ffi/tutorial/examples

And a nice blog post:

> **[Tutorial: Using Racket's FFI](https://prl.ccs.neu.edu/blog/2016/06/27/tutorial-using-racket-s-ffi/)**
>
> Update: this post is now part of a series. Part 2 is here and part 3 is here. I've seen several people ask for a tutorial on Racket's foreign function interface (FFI), which allows you to dynamically load C libraries for use in Racket code. While I...

---

<div class="post-metadata">

**Author:** ![Decabytes](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/decabytes/32/54_2.png) [@Decabytes](https://racket.discourse.group/u/Decabytes)\
**Post date:** [April 20, 2022, 1:57am UTC](https://racket.discourse.group/t/help-where-to-find-ffi-examples/896/4 "2022-04-20T01:57:34Z")

</div>

This is incredible. I'm currently [adding types to a fork](https://github.com/diego-crespo/racket-raylib/blob/main/generated/typed-racket/functions.rkt) of @Eutro's [racket-raylib](https://github.com/eutro/racket-raylib) library for a small 2d game I'm working on. I want the compile time errors because when I pass the wrong types to a function or struct (like supplying Integers instead of Floats to Rectangles) in the main loop after the window is created, Racket crashes and the window becomes unresponsive until I open task manager and manually kill the task. I've been struggling with how to type some of the more complex values and this is an invaluable resource
