这是使用dll的好方法吗? (C ++?) [英] Is this a good way to use dlls? (C++?)

查看:111
本文介绍了这是使用dll的好方法吗? (C ++?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样运行的系统:



main.exe运行sub.exe运行sub2.exe



等等...



嗯,将sub和sub2更改为dll会更有效率吗?



如果是这样,有没有人可以指出我正确的方向,使他们的dll没有改变很多代码?

解决方案

DLLs将比单独的可执行文件更快。但是保持它们分开允许更多的灵活性和重用(认为Unix shell脚本)。



这个似乎是Win32的一个很好的DLL教程。



至于不改变代码很多,我假设你只是使用命令行参数将信息传递给论坛。在这种情况下,只需重命名 main 函数,从DLL导出它们,并将其重命名为 main 函数从主程序。


I have a system that runs like this:

main.exe runs sub.exe runs sub2.exe

and etc. and etc...

Well, would it be any faster of more efficient to change sub and sub2 to dlls?

And if it would, could someone point me in the right direction for making them dlls without changing a lot of the code?

解决方案

DLLs would definitely be faster than separate executables. But keeping them separate allows more flexibility and reuse (think Unix shell scripting).

This seems to be a good DLL tutorial for Win32.

As for not changing code much, I'm assuming you are just passing information to theses subs with command line arguments. In that case, just rename the main functions, export them from the DLL, and call these renamed "main" functions from the main program.

这篇关于这是使用dll的好方法吗? (C ++?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆