如何从Windows应用程序创建DLL并同时隐藏不需要的功能? [英] How to create dll from windows app and concurrently hide unwanted functionality?

查看:88
本文介绍了如何从Windows应用程序创建DLL并同时隐藏不需要的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

有谁知道我该怎么做?我需要创建DLL - 我可以做到这一点。但我不希望所有名称空间/类/函数都可用。有没有简单的方法来实现这个目标?



非常感谢

Pavel

Hello,
does anybody know how can I do that? I need to create dll - I can do that. But I dont want all namespaces/classes/functions to be available. Is there some simple way to achieve this?

Thanks a lot
Pavel

推荐答案

这是一个很好的重构机会。



您正在使用一组代码来执行可执行文件和库,那么您做错了。您应该创建一个单独的项目,其中包含您要作为API公开的内容,然后从EXE项目中引用它,并在其中包含API中不需要的内容。这样做是正确的编程,它使您的软件更易于维护和使用。
This is a great opportunity for refactoring.

You are using one set of code for both executable and library, then you are doing it wrong. You should create a separate project with the things you want to expose as an API, then reference it from the EXE project and have in there the stuff you don't need in the API. Doing it this way is just proper programming, it makes your software more maintainable and easier to work with.


然后您真的需要返回并重新评估您在Windows中放置的功能表单应用。您需要共享的功能可能会进入您自己的Windows窗体应用程序和其他应用程序使用的单独项目。每次要重新编译任一应用程序时,没有其他方法可以修改代码。
Then you really need to go back and re-evaluate what functionality you put in the Windows Forms app. The functionality that you need to share should probably go into its own seperate project that your Windows Forms app and other application uses. There is no other way without modifying the code every time you want to recompile either app.


这篇关于如何从Windows应用程序创建DLL并同时隐藏不需要的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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