# Can binaries made with juliac --trim open files or read input?

**URL:** <https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059>\
**Category:** General Usage\
**Created:** [October 10, 2025, 10:51pm UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059 "2025-10-10T22:51:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeePhillips](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leephillips/32/205514_2.png) [@LeePhillips](https://discourse.julialang.org/u/LeePhillips)\
**Post date:** [October 10, 2025, 10:51pm UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059/1 "2025-10-10T22:51:33Z")

</div>

That’s my question. Does anyone have a working example of a program that compiles under v1.12 using `juliac --trim=safe` etc. that either opens and reads from a file or reads input from the terminal?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [October 10, 2025, 11:24pm UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059/2 "2025-10-10T23:24:24Z")

</div>

Next point on the TODO list:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/e/8e5bdea3733a31c125e27e9b14a454eccc48fbd2.jpeg)

From the presentation on JuliaCon, July 2025.

---

<div class="post-metadata">

**Author:** ![suavesito](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/suavesito/32/34386_2.png) [@suavesito](https://discourse.julialang.org/u/suavesito)\
**Post date:** [October 11, 2025, 2:28am UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059/3 "2025-10-11T02:28:58Z")

</div>

You can try with [StaticTools.jl](https://github.com/brenhinkeller/StaticTools.jl), although it will have caveats, if it works at all. But you can check. 🙂

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 11, 2025, 5:21am UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059/4 "2025-10-11T05:21:31Z")

</div>

This old demo does some low level reading and writing

> <https://github.com/baggepinnen/static_kalman/blob/25cb53cb63a882e388348e0deb2860c490c9451b/juliac/juliac_demo.jl#L36>

---

<div class="post-metadata">

**Author:** ![minetest2048](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/minetest2048/32/45961_2.png) [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Post date:** [October 11, 2025, 7:12am UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059/5 "2025-10-11T07:12:07Z")

</div>

I played around with wrapping `liburing` so that I can use `io_uring` to asynchronously read and write in trimmable Julia. I managed to write my own basic `cp`, but the API is still not ready for public consumption yet as I’m still trying to figure out how to use sum types to safely wrap C APIs without using exception

---

<div class="post-metadata">

**Author:** ![RoyW](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@RoyW](https://discourse.julialang.org/u/RoyW)\
**Post date:** [November 28, 2025, 6:51am UTC](https://discourse.julialang.org/t/can-binaries-made-with-juliac-trim-open-files-or-read-input/133059/6 "2025-11-28T06:51:57Z")

</div>

I made a minimalist tutorial for reading and saving binary files: [comile-julia-examples](https://codeberg.org/RoyCCWang/compile-julia-examples). Perhaps it can be helpful to you until JuliaC can handle more IO functionalities. Quick notes:

- Tutorial written for and tested on Julia `v1.12.1` and JuliaC `v0.2.2`, on 64-bit Fedora Workstation 43.
- My example did not explicitly handle endian options. Look at the docs for `read`, `write`, ` htol`, and `ltoh` if you need explicit control.
- I hardcoded this example to interpret `UInt8` as `Float64` to avoid type instability issues. A few of my alternative read and write routines passed `code_warntype` tests, but `JuliaC v0.2.2` didn’t want to compile those routines.
- Storage footprint on my machine for the `build` folder was around ~80 MB.
- The compiled binary worked when I copied the `build` folder to my other PC that also has Fedora Workstation 43 and Julia `v1.12.1` installed. I haven’t done further testing on the portability and the required dependencies for the binary.
