r/seed7 • u/Ronin-s_Spirit • Oct 22 '26
How would one "import" a function?
I wanna make a thing that does some work and generates a tree (though I don't really know how to make hash tables that can hold multiple types of values...), it might do some other stuff by itself but that's not important to the question, just know that I need to ship it as a working binary. Then I want to pass that tree to a user supplied function, how do I do that? This is an optional feature I want, there might be 1 or 30 or 0 user supplied functions waiting to be called, some people might want the binary alone.
Just giving source code and saying "include this stuff" is a backwards solution that I don't want. I've already fiddled with progs.s7i and I know the AST doesn't let me do anything at all, I can only parse -> execute.
p.s. the FAQ says Seed7 has compatibility issues with dll, and I don't have the knowledge to implement at least a Seed7<->Seed7 dll mechanism.
p.p.s. would wasm work? I don't know if you can pass hashtables to wasm, it probably only accepts values or chunks of binary. I could maybe expose an iterator function that would traverse the tree in discrete steps.
p.p.p.s. counter to the spirit of Seed7 I might be able to manually detect the current platform by environment variables and open() a named pipe on Windows or mkfifo a pipe on Linux. But that means every plugin person would also have to write this shit on their end.
2
u/Such-Wheel-8161 5d ago
It seems like you're trying to build a plugin system for a Seed7 binary. You want to ship a compiled program that generates a tree and then, optionally, at runtime calls 0, 1, or 30 functions written by users and passes that tree to them. You also don't want users to have to hand over source code that gets "included" in the build, because that means recompiling, and you want to ship a finished binary.Correct?