4 ms·
Show HN: Adding dynamic library loading to my pet programming language
- cdcarter 3y agoI'd love to see some details on what you encountered while adding dynamic loading. There are a lot of decisions to make. In python, importing a package executes the static blocks. In the JVM, import doesn't have a side effect but the first actual usage causes statics to run. Similarly you need to decide what you'll do with conflicting names. Namespaces? last one wins?
- nbittich 3y agoThank you for your interest! It wasn't too hard to be honest, the actual tradeoff is that the shared object must have been built with the same version of rust that was used to build the runtime(see https://github.com/nbittich/adana#plugins https://github.com/nbittich/adana#plugins) for the way it's loaded, it's like in nodejs with common modules: my_lib = require("/path/to/my_lib.so") or for standard lib: fs = require("@std/fs")
- slaymaker1907 3y agoIt also executes a bunch of code in C++ (at least for Windows) and can do all sorts of wild stuff. It happens when you define globals with constructors that the compiler can't/doesn't optimize away.
- catlover76 3y agoPretty sure "Adana" is just the kabab part, and not "a long, skewer-cooked ground beef kabab put alongside fries in a sliced baguette, covered in mystery sauce" :P
- nbittich 3y agoAhahh, the name would have been too long xD
- lilora2 3y ago[flagged]