Interfacing with user-supplied binary or obj file

frame frame86 at live.com
Sun Jul 31 23:06:06 UTC 2022


On Sunday, 31 July 2022 at 10:55:58 UTC, TheZipCreator wrote:
> So I'm making an interpreter for my custom scripting language 
> and I want to allow users to write libraries in languages other 
> than said scripting language (for efficiency). For example, you 
> should be able to write a mathematics library in D, compile it, 
> then write a simple wrapper in my language and then be able to 
> import it to your script to use (similar to a lot of Python 
> libraries). So how exactly could I do this without requiring to 
> user to recompile the interpreter every time they want to use a 
> new library? Is there some way I could dynamically link in 
> compiled .obj files?

Dynamically linking .obj files is basically wrapping all together 
to a shared library, loaded at runtime. So you need an interface 
that interops with your script language that must provide options 
to exchange input/output, registering functions that are callable 
from your script while your library is loaded and such stuff. The 
final logic is up to you.



More information about the Digitalmars-d-learn mailing list