关于DLL的问题。 .c和.h文件之间的区别 [英] Questions about dll. Difference between a .c and .h file

查看:88
本文介绍了关于DLL的问题。 .c和.h文件之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次在这里发帖,但我有一点问题。我在C中获得了两个旧文件,它们都被认为是Dll,但其中一个在.c中,另一个在.h中。 .c有大约30个函数,而.h有4个函数(都在.C中定义)。 *(我想说我知道.h代表标题)*



我想知道这样做有什么意义?显然.c文件中的工程师想要隐藏.c中的大部分功能,所以他们使用了EXPORFCT(谁知道那是什么......)而在.h中他们只声明了4个被定义的函数在.C文件中。



任何机构都可以向我解释这样做有什么意义吗?有人只能使用私人从外面无法访问吗?在dll的情况下,EXPORFCT是什么?



这一切都是因为1)我在EXPORTFCT上找不到任何东西,2)我在Dll制作时完全是菜鸟,3)我没有看看制作2个dll的点。



我尝试过:



尝试在谷歌上查找EXPORTFCT以及MSDN和TechNet的定义。另外还有关于如何制作DLL文件的教程,但我似乎无法隐藏以前隐藏在旧DLL中的函数

First time posting here, but I'm having a little issue. I was given two old files in C. both of them are considered Dll but one of them is in .c and the other in .h. The .c has about 30 functions whereas the .h has 4 functions ( that are all defined in the .C). *( I do want to say that I know .h stands for header)*

I was wondering what is the point of doing so? Apparently the engineers on the .c files wanted to hide a good part of the functions from the .c so they used EXPORFCT(??? who knows what that is..) and in the .h they only declared 4 functions that were defined in the .C file.

Can any body explain to me what is the point of doing so? Can't someone just use Private for it to be non-accessible from the outside? What is EXPORFCT in the case of a dll?

This is all asked because 1) I can't find anything on EXPORTFCT , 2) I'm a completely noob at Dll making and 3) I don't see the point of making 2 dll.

What I have tried:

Tried looking on google for definition of EXPORTFCT as well as MSDN and TechNet. Also followed a tutorial on how to make the DLL file, but I can't seem to hide the functions that were previously hidden in the old DLL

推荐答案

你的问题告诉我我们你正在向后学习C.这是错的。

要学习C,首先阅读Kernihan& Ritchie的书,这是强制性的。



就像你开车学习一样,在把手放在方向盘上之前,你需要学习所有的路标,无论如何什么。

这本书解释了C的所有概念并让你走上正轨。



C编程语言 - 维基百科,免费的百科全书 [ ^ ]

https:// hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf [ ^ ]

http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.p df [ ^ ]
Your question tells us that you are learning C backward. It is all wrong.
To learn C, start by reading the Kernihan & Ritchie book, it is mandatory.

It is like when you learn to drive, you are required to learn all road signs before putting your hands on the wheel, no matter what.
This book explain all the concepts of C and put you on tracks.

The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]


我的两分钱:

My two cents:
Quote:

第一次在这里发帖,但我有一点问题。我在C中获得了两个旧文件,它们都被认为是Dll,但其中一个在.c中,另一个在.h中。 .c有大约30个函数,而.h有4个函数(都在.C中定义)。 *(我想说我知道.h代表标题)*

First time posting here, but I'm having a little issue. I was given two old files in C. both of them are considered Dll but one of them is in .c and the other in .h. The .c has about 30 functions whereas the .h has 4 functions ( that are all defined in the .C). *( I do want to say that I know .h stands for header)*

源文件和头文件通常都有助于DLL buld进程。

你需要头文件从你的应用程序调用导出的 DLL 函数(你还需要 .lib 文件以正确链接您的应用程序。)



Both the source and the header file usually contribute to the DLL buld process.
You do need the header file to call the exported DLL functions from your application (you also need the .lib file to correctly link your application).

Quote:

我想知道这样做有什么意义?显然.c文件中的工程师想要隐藏.c中的大部分功能,所以他们使用了EXPORFCT(谁知道那是什么......)而在.h中他们只声明了4个被定义的函数在.C文件中。

I was wondering what is the point of doing so? Apparently the engineers on the .c files wanted to hide a good part of the functions from the .c so they used EXPORFCT(??? who knows what that is..) and in the .h they only declared 4 functions that were defined in the .C file.

重点是导出 API 并隐藏实现。 EXPORFCT 可能是一个'自定义'宏(我之前从未听说过)可能以 dllexport 结尾(请参阅 dllexport,dllimport [ ^ ])假设代码适用于Windows操作系统。



The point is exporting the API and hiding the implementation. The EXPORFCT is probably a 'custom' macro (I never heard about it, before) possibly ending up in dllexport (see dllexport, dllimport[^]) assuming the code is for Windows OS.

Quote:

任何机构都可以向我解释这样做有什么意义吗?不能有人只是使用Private才能从外面无法访问它吗?在dll的情况下,EXPORFCT是什么?

Can any body explain to me what is the point of doing so? Can't someone just use Private for it to be non-accessible from the outside? What is EXPORFCT in the case of a dll?

不, C 提供NO访问说明符(private,protected,...),例如 C ++ 确实。







No, C provides NO access specifiers (private, protected, ...) like, for instance, C++ does.



引用:

1)我在EXPORTFCT上找不到任何东西,2)我在Dll制作中完全是noob 3)我没有看到制作2 dll的意义。

1) I can't find anything on EXPORTFCT , 2) I'm a completely noob at Dll making and 3) I don't see the point of making 2 dll.

EXPORTFCT 可能是在头文件中定义的。

如果你是 DLL 制作完全noob那么很自然你没有看到这个或那个点。现在是时候学习了。

EXPORTFCT is probably defined in the header file.
If you are completely noob at DLL making then it is pretty natural that you don't see the point of this or that. It is just time to learn.


请看我对这个问题的评论,还有一些基础知识,我最近的答案:内联函数在标题或实现中执行得更快? C ++ [ ^ ]。



您的问题无法按照公式回答,因为大多数问题都是以太逻辑不正确或基于错误的假设或错误的猜测,但你可以得到一些建议。



首先,你必须调整你的方法。例如,不要急于问做这个和这个有什么意义?正确的方法是了解到底发生了什么。另外,在提出问题之前阅读主题,只有这样你才能提出一些富有成效的问题。例如,你不会问关于DLL的问题你是否理解普通静态库并更好地链接。然后你可以看到一些关于静态模块限制的挫折感,甚至可能自己想到了DLL的想法。我在一些同事,当时绝对的初学者中观察到了这种思想的发展。然后,您可以阅读有关DLL的信息。例如,参见:

动态链接库 - 维基百科,免费的百科全书 [ ^ ],

Dynamic-Link Libraries(Windows) [ ^ ]。br />


但我强烈建议您了解单片可执行模块的构建是如何工作的,什么是编译器,链接器的作用。此刻,你显然没有任何线索。这不是问题,你可以根据常规学习快速学习它。



此外,看起来你已经修改了隐藏其他编程断言的想法开发人员,或许与您的知识产权相关的事情。这是我的建议:暂时忘掉它。我们在此页面上讨论的所有主题与此类问题完全无关。当你学会开发足够有价值的东西时,可能会成为窃取知识产权的附件的目标,你对此事的看法可能会发生根本性的变化。现在不是关注它的最佳时机。



-SA
Please see my comment to the question and also, for some basics, my recent answer: Inline functions executed faster in header or implementation? C++[^].

Your questions cannot be answered as formulated, because most of them are ether logically incorrect or based on wrong assumption or wrong guess, but you can just get some advice.

First of all, you have to tune up your approach. For example, don't rush into asking "what is the point of doing this and this"? Right approach would be learning what exactly is going on. Also, read on the topic before asking questions, only then you would be able to ask some productive question. For example, you would not ask questions about DLL is you understood "normal" static libraries and linking better. Then you could see some frustration about the limitation of static modules and maybe even get to the idea of DLLs by yourself. I observed such development of thought in some of my colleagues, absolute beginners at that time. And then, you could read about DLLs. See, for example:
Dynamic-link library — Wikipedia, the free encyclopedia[^],
Dynamic-Link Libraries (Windows)[^].

But I would strongly recommend that you learn how the build of the monolithic executable module works, what is fed to the compiler, what a linker does. At this moment, you apparently have no clue. It's not a problem, you can quickly learn it, based on regular study.

Also, it looks like you are fixed on the idea of hiding some programming asserts from other developers, something related to your intellectual rights, perhaps. Here is my advice: forget it for now. All the topic we discussed on this page are totally irrelevant to such issues. By the time you learn to develop something valuable enough, which potentially can become a target of the attach of stealing of the intellectual properties, you views on this matter may radically change. It's not the right time to be concerned with that.

—SA


这篇关于关于DLL的问题。 .c和.h文件之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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