Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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
Posted
Updated 1-Jun-16 10:25am
v2
Comments
Sergey Alexandrovich Kryukov 1-Jun-16 13:54pm    
Nearly all questions about "difference" are logically incorrect. What's the difference between apple and Apple? :-)

No, none of the source files are "considered DLL". No, separation of code between .c and .h has nothing to do with hiding.

No, it's also not related to compilation into .EXE or .DLL. Totally.

No, "private" is also not related to hiding some "secret" code. It's only a matter of discipline of programming, maintainability.

No, I have no idea what EXPORTFCT is. I strongly suspect it's just your fantasy, maybe something stemmed from some misspelling.

—SA

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[^]
 
Share this answer
 
v2
Comments
CPallini 1-Jun-16 16:07pm    
5
Patrice T 1-Jun-16 16:53pm    
Thank you
My two cents:
Quote:
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)*
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:
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.
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:
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?
No, C provides NO access specifiers (private, protected, ...) like, for instance, C++ does.



Quote:
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 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.
 
Share this answer
 
Comments
Patrice T 1-Jun-16 16:56pm    
5ef too
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
 
Share this answer
 
Comments
CPallini 1-Jun-16 16:08pm    
5.
Sergey Alexandrovich Kryukov 1-Jun-16 16:09pm    
Thank you, Carlo.
—SA
Patrice T 1-Jun-16 16:58pm    
5ed too
Sergey Alexandrovich Kryukov 1-Jun-16 18:47pm    
Thank you.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900