




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Import Library is statically linked to Executable module.
Example of Import libraries in windows are:
Important System DLLs are
Functions used in DLL’s are normally use __stdcall calling convention. __stdcall calling convention is a standard calling convention used by the APIs in Windows. This calling convention cleans the stack after returning the called procedure automatically. No extra code is needed to clean out stack. __stdcall calling convention pushes the arguments in stack from right to left order.
Variables defined in DLL have scope in memory until the DLL is loaded. After unloading, the variable scope is vanished. Locally defined variables are accessed within the DLL only. The variables that are set to export variables can be accessed outside the DLL if the DLL is statically linked.
Variables can be shared across multiple processes by making the separate data section as following.
#pragma data_seg( [ [ { push | pop } , ] [ identifier , ] ] [ "segment- name " [, " segment-class " ] )
Specifies the data segment where initialized variables are stored in the .obj file. OBJ files can be viewed with the dumpbin application. The default segment in the .obj file for initialized variables is .data. Variables initialized to zero are considered uninitialized and are stored in .bss.
Do not use the following names, as they will conflict with standard names. For example, .sdata is used on RISC platforms:
Specify one or more attributes for the section. The attribute characters, listed below, are not case sensitive. You must specify all attributes that you want the section to have; an omitted attribute character causes that attribute bit to be turned off. If you do not specify R, W, or E, the existing read, write, or executable status remains unchanged.
The meanings of the attribute characters are shown below.
Character Attribute Meaning E Execute The section is executable R Read Allows read operations on data W Write Allows write operations on data
S Shared Shares the section among all processes that load the image D Discardable Marks the section as discardable K Cacheable Marks the section as not cacheable
L Preload VxD only; marks the section as preload P Pageable Marks the section as not pageable X Memory-resident VxD only; marks the section as memory-resident
K and P are peculiar in that the section flags that correspond to them are in the negative sense. If you specify one of them on the .text section (/SECTION:.text,K), there will be no difference in the section flags when you run DUMPBIN with the /HEADERS option; it was already implicitly cached. To remove the default, specify /SECTION:.text,!K and DUMPBIN will reveal section characteristics, including "Not Cached."
A section in the PE file that does not have E, R, or W set is probably invalid.
To set this linker option in the Visual Studio development environment
Resource Only DLL contains only resource of different language and local types. Resource only DLLs do not contain Entry Point or any DllMain Function.
Use of resource-only DLL is for internationalization.
Version information makes it easier for applications to install files properly and enables setup programs to analyze files currently installed. The version-information resource contains the file's version number, intended operating system, and original file name.
You can use the version information functions to determine where a file should be installed and identify conflicts with currently installed files. These functions enable you to avoid the following problems:
The version information functions enable applications to query a version resource for file information and present the information in a clear format. This information includes the file's purpose, author, version number, and so on.
You can add version information to any files that can have Microsoft® Windows® resources, such as dynamic-link libraries (DLLs), executable files, or font files. To add the information, create a VERSIONINFO Resource and use the resource compiler to compile the resource.
The GetFileVersionInfo function retrieves version information for the specified file.
BOOL GetFileVersionInfo(
Worker threads are initially without message queue.
User Interface threads are those threads which are attached any GUI component such as window.
When a process start at least one thread is running that first thread is called primary thread other threads can made, these threads will, then, be called secondary threads.
For creating thread we can use following functions:
_beginthread() and _endthread() This function is a ‘C’ runtime concept from UNIX system These functions no longer have place in Win32 systems.
The CreateThread API
In windows systems CreateThread API is used to create a thread in a process. Every thread has its own thread procedure.
Using threads has the following advantages:
Threads major disadvantage is that they make the system slow because thread uses the time sharing concept that is another name multitasking. A multitasking operating system divides the available processor time among the processes or threads that need it. The system is designed for preemptive multitasking; it allocates a processor time slice to each thread it executes. The currently executing thread is suspended when its time slice
elapses, allowing another thread to run. When the system switches from one thread to another, it saves the context of the preempted thread and restores the saved context of the next thread in the queue.
The length of the time slice depends on the operating system and the processor. Because each time slice is small (approximately 20 milliseconds), multiple threads appear to be executing at the same time. This is actually the case on multiprocessor systems, where the executable threads are distributed among the available processors.
Note: You must use caution when using multiple threads in an application, because system performance can decrease if there are too many threads.
Multitasking Operating systems are useful to run applications simultaneously. Threads and processes are the key features of Operating systems. In this lecture we studied about variable sharing in DLLs, variable scope in DLLs, DLL Versioning, Resource only DLLs, Threads and their advantages and disadvantages. Many Threads can work better than using single thread sometime.