简体   繁体   English

.exe vs .dll作为一个程序的模块

[英].exe vs .dll as modules of one program

For example, we have an interface of program for image processing written in C/C++. 例如,我们有一个用C / C ++编写的图像处理程序接口。 And we have such things as filters, blurring, deblurring, resizing, compressing and all other stuff that takes a lot of computations. 我们有过滤,模糊,去模糊,调整大小,压缩等所有其他需要大量计算的东西。 How would you design such app modules - as .exe interface + group of .exe modules throwing files between each other or as .exe interface + .dlls with needed methods? 你会如何设计这样的应用程序模块 - 如.exe接口+ .exe模块组在彼此之间抛出文件或者.exe接口+ .dll与所需的方法?

What are advantages and disadvantages of every method? 每种方法的优点和缺点是什么?

If I use .dlls, in what cases I will be forced to recompile interface's .exe? 如果我使用.dll,在什么情况下我将被迫重新编译接口的.exe? Let's suggest that data size that must be given to modules is big enough to prefer to write it on disk in some places of execution. 让我们建议必须给模块的数据大小足够大,以便在某些执行地点将其写入磁盘。

Thanks in advance. 提前致谢。

PS Image processing is just the example, any system with such modules can be places in the question. PS图像处理就是一个例子,任何具有这种模块的系统都可以成为问题所在。

This depends on how tightly coupled your system is and also on the performance issues. 这取决于系统的紧密耦合程度以及性能问题。

  1. If you want to use code from different vendors, shared files with known format are preferrable. 如果要使用来自不同供应商的代码,则可以使用已知格式的共享文件。

  2. If you need to process thousand images per second, then DLLs might be better. 如果你需要每秒处理数千个图像,那么DLL可能会更好。

I'd use DLLs, that's what they're intended for. 我会使用DLL,这就是他们的目的。 In terms of recompilation: You will have to recompile your DLLs if you change the binary interface between the EXE and the DLL! 在重新编译方面:如果更改EXE和DLL之间的二进制接口,则必须重新编译DLL!

If you go for DLLs and want to be compiler independent, you will have to define a STABLE ABI. 如果您使用DLL并希望独立于编译器,则必须定义STABLE ABI。 This can either be done in terms of C + some typedefs (signedness of char, size of bool, ...) or akin to how COM handles that. 这可以用C +一些typedef(char的签名,bool的大小,......)来完成,或类似于COM处理它的方式。

I personally would go for the second route - knowing how much time it takes to define a good binary stable ABI... 我个人会选择第二条路线 - 知道定义一个好的二元稳定ABI需要多长时间......

I would use DLLs with needed methods. 我会使用所需方法的DLL。 DLLs are just designed for that job. DLL只是为那个工作而设计的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM