如何制作 C++程序从外部文件读取算法?
我知道这是一个奇怪的问题,但我想设计一个可以运行场景的程序,这个场景有一些功能,比如搜索、删除……
这些函数的定义方式将取决于用户,他可以定义这些功能,比如定义场景应该如何运行。
我认为可以在 C# 中通过让客户端定义带有某些类继承的接口的 dll 文件来完成,使用动态链接可以加载程序集。
这是可以在 C# 中完成的事情,但在 C++ 中我不知道该怎么做。 我想让软件保持关闭状态,我想我应该编写自定义脚本语言来做到这一点。
我正在使用 QT 框架
你有什么想法吗?谢谢
I know it's a weird question but I want to design a program that will run scenario, this scenario has some functions like searching, deleting ....
these function how they are defined will be up to user, he can define these functionality like defining how the scenario should run.
I'm thinking it can be done in C# by making the client define dll file with interfaces inherited by some classes, using the dynamic linking the assembly can be loaded.
it's something can be done in C# but in C++ I don't know how to do it.
I want to keep the software closed, and I was thinking I should write custom scripting language to do it.
I'm using QT framework
Do you some ideas? thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您使用的是 Qt,您可以查看他们的 QtScript 框架;它可能会做您想做的事情,并且它已经集成到 Qt 中,因此您无需进行太多设置即可使用它。
Since you're using Qt, you might check out their QtScript framework; it might do what you want, and it's already integrated into Qt so you wouldn't have to set very much up to use it.
使用脚本语言;这正是他们的目的。我选择 Lua 作为嵌入式语言的默认选择,但其他人则坚信 Python。 JavaScript 也有嵌入式版本。
Use a scripting language; this is exactly what they are for. Lua is what I would pick as my default go-to for embedded languages, but others swear by Python. There are embedded versions of JavaScript as well.