Re:I let LLMs write an Elixir NIF in C; it mostly worked
by victorbjorklund on Friday August 15, 2025 @01:21PM
(#44915035)
Not only C. Can be done in any compiled language (C, Rust, Zig, etc). Not sure if can be done with GC language.
Re:I let LLMs write an Elixir NIF in C; it mostly worked
by toast0 on Friday August 15, 2025 @02:26PM
(#44915842)
BEAM loads a shared object, that opens the door to anything.
If you want to use a GC language for NIFs, you'd need to hook up your runtime somehow.
IMHO, it makes more sense to lean into the BEAM and use its resource management... my NIFs have all been pretty straight forward to write. All the boiler plate is what it is, and figuring out how to cooperate with the scheuduler for long running code or i/o can be a bit tricky, but if you can do a lot in a BEAM language, the native code ends up being like
Check the arguments, do the thing, return the results.
I had a bunch of fun getting ChatGPT Code Interpreter to write (and compile and test) C extensions for SQLite last year: https://simonwillison.net/2024/Mar/23/building-c-extensions-...