473,769 Members | 7,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the relation/difference between a header file, dll and library?

8 New Member
What is the relation/difference between a header file, dll and library?
Sep 29 '05 #1
11 20210
lini
12 New Member
A header file contains declaration of something (constants, classes, ...), usually ends with a .h or hpp extension.

A DLL (dynamically linked library) is a binary file (with .dll, .ocx, .a, ... extentions), containing functions, resources, ... and can be linked to your program at run-time. In order to use a DLL you need to include the corresponding header file, which declares things in the DLL, so that your program gets compiled. The DLL file is automatically loaded (by system) at run-time when your executable program invokes functions and asks for resources.

A library file (also called static library, with .lib extension usually) is a binary file which alsocontains functions and variables like DLL, but resolved at compile-time, meaning they need to be provided at link-time.

Dynamic and static libraries are often provided together with header file (but no source file, which contains the implementation) when the provider lets you use his/her functions/services but doesnt give you access to the implementation.

Is that what you ask?
Dec 15 '08 #2
donbock
2,426 Recognized Expert Top Contributor
Lini has summarized the generic meaning of "DLL". The same term is also used for the specific form of dynamic-link-library used by Windows and OS/2. Do you know whether you're referring to term generically or specifically in a Microsoft context?
Dec 15 '08 #3
MrPickle
100 New Member
@lini
Is there a difference between .h & .hpp?
Dec 15 '08 #4
Banfa
9,065 Recognized Expert Moderator Expert
Not really. .h is a header file, .hpp is also a header file but typically only used in a C++ environment.

However when you get right down to it a header file can have any extension you want, it is only convention that uses h (for header).
Dec 15 '08 #5
Balasing
1 New Member
Thanks. Good & clear answer pal
Jul 7 '09 #6
RedSon
5,000 Recognized Expert Expert
What are the memory requirements between static and dynamic libs? For example how is the heap and stack represented on each? When a process uses a DLL does it make a copy of the whole DLL? Do singleton classes implmented in DLLs remain a singleton between processes?

What is a "DLL boundry"? Why is communicating across DLL boundaries difficult or complicated to achieve?

I recently switched to a different project and I'm afraid I don't know what I'm doing now... :(
Jul 9 '09 #7
JosAH
11,448 Recognized Expert MVP
@RedSon
In every self respecting Linux/Unix distribnution the 'text segments' of .so files (the equivalent of dll files) are only loaded once, so if two or more people use the same .so file the text segment (the part where the code is) is loaded only once). When the last user stops his/her process the segment is unloaded.

Static libraries don't have that advantage, i.e. they are completely loaded by every process that was linked against the static library because the code is part of the entire process, i.e. executable file.

I assume the same scenario works for Microsoft's .dll files.

kind regards,

Jos
Jul 9 '09 #8
Banfa
9,065 Recognized Expert Moderator Expert
It is the same for Windows DLLs Jos.

One of the main differences between 16bit and 32bit windows is/was that under 16 bit windows memory used by a DLL was shared by all programs using the DLL. That is in 16bit Windows you could use a DLL to transfer data between programs easily.

In 32bit Windows the data used by DLLs is not shared between programs, each program instance of the DLL uses different data mapped into the programs virtual memory space. However the text segment (code) is only loaded once I believe.

Because the DLL and the application are different processes there are some class issues. For instance static data in a class used in a DLL and an application using the DLL results in the application and the DLL each having their own copy of the static data.
Jul 9 '09 #9
RedSon
5,000 Recognized Expert Expert
@Banfa
Can you explain this in more detail?
Jul 9 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

31
2805
by: Steven T. Hatton | last post by:
If a header is not necessarily a source file, and the sequences delimited by < and > in header names aren't necessarily valid source file names, what exactly is a header? -- p->m == (*p).m == p.m http://www.kdevelop.org http://www.suse.com http://www.mozilla.org
4
2605
by: s.subbarayan | last post by:
Dear all, How different is a header file from a library file in C?Under what circumstance u go for library and under what circumstance u go for header?Afaik,both have some declarations which can be called from a source file.And what should I do if i want to build a library?Is it that jus setting the compiler option to be library makes u to create a library or u have to do something in the code to create a library? I am sorry if it looks...
0
3940
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
1
4607
by: C. Jayachandran | last post by:
I've inherited some code which has const std::string values defined in a header file, like const std::string str = "foo"; This causes a large amount of bloat, as all the compilation units including this header file will have a copy of the string, as well as code to construct and destruct the string, even if the string is not used within the CPP file.
11
2811
by: Gary Wessle | last post by:
Hi is it right to have a line like #include <path/to/header.hfor a library on my system, in my header file and use some functions provided by this library in the implementation file (file.cpp) inside a class with out declaring those functions in the class declaration in the header file? thanks
2
1229
by: anarghya | last post by:
what does the header file contains?
3
1997
by: silverWolf | last post by:
2. What is the relation between header file ( #include<iostream.h>) and input output function?
2
9009
by: shariquehabib | last post by:
Hi All, Can any one let me know the correct diffrence between static library and dynamic library while using C language? ------------- Sharique
4
3801
by: Sivani | last post by:
i need the header file for Sleep in Keil Operating system
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.