Dynamic Link Libraries (DLL)

Slides:



Advertisements
Similar presentations
Introduction to Programming in C++ John Galletly.
Advertisements

Programming Languages and Paradigms The C Programming Language.
CS 31003: Compilers ANIRUDDHA GUPTA 11CS10004 G2 CLASS DATE : 24/07/2013.
Programming with Objects: Class Libraries and Reusable Code.
Programming Languages and Paradigms Object-Oriented Programming.
1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.
!!! Global Variables!!! are EVIL SSimply because you just write a school boy/gal?
Win32 Programming Lesson 20: Advanced DLL Techniques.
Adv. UNIX: large/131 Advanced UNIX v Objectives of these slides: –learn how to write/manage large programs consisting of multiple files, which.
Linking and Loading Linker collects procedures and links them together object modules into one executable program. Why isn't everything written as just.
Saves memory and reduces swapping No recompilation on changes A DLL can provide after-market support Programs written in different languages can call the.
Lecture 11 Dynamic link libraries. Differences between static libraries and DLLs In static library code is added to the executable. In DLL, the code is.
Introduction to C & C++ Lecture 10 – library JJCAO.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
C/C++ Programming Environment
111 Introduction to OGRE3D Programming: Main Loop.
Dynamic Link Libraries: Inside Out. Dynamic Link Libraries  About Dynamic-Link Libraries  Dynamic-Link Libraries Hands On  Dynamic Link Library Reference.
Writing a Run Time DLL The application loads the DLL using LoadLibrary() or LoadLibraryEx(). The standard search sequence is used by the operating system.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC PROGRAMMING FUNDAMENTALS Bilal Munir Mughal 1 Chapter-8.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
1 How to Install OpenGL u Software running under Microsoft Windows makes extensive use of "dynamic link libraries." A dynamic link library (DLL) is a set.
Functions  A Function is a self contained block of one or more statements or a sub program which is designed for a particular task is called functions.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Win32 Programming Lesson 19: Introduction to DLLs.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Program Libraries 1. What is a program library? A library is a collection of implementations of behavior, written in terms of a language, that has a well-defined.
Andy Wigley Device Application Development MVP APPA Mundi Ltd SESSION CODE: WEM309.
OE-NIK HP Advanced Programming Using and creating DLL files.
Introduction to GCC Department of Radio Physics and Electronics ILug-Cal Introduction to GCC Department of Radio Physics and Electronics, Calcutta University.
Memory Management Chapter 7.
Topic 2: Hardware and Software
CSE691 Software Models and Analysis.
CIS 200 Test 01 Review.
ENERGY 211 / CME 211 Lecture 25 November 17, 2008.
Threads in C Caryl Rahn.
Thread Programming.
Lecture on Oracle Forms
Chapter 8 Main Memory.
Accomplishing Executables
Programs – Dynamic Linking and Loading
CSC113: Computer Programming (Theory = 03, Lab = 01)
CSCI 161: Introduction to Programming Function
Larger Projects, Object Files, Prototyping, Header Files, Make Files
This pointer, Dynamic memory allocation, Constructors and Destructor
Chapter 5 - Functions Outline 5.1 Introduction
The Assembly Language Level
Introduction to Classes
MEMORY MANAGEMENT & their issues
Visual Studio 2005 Options for Release Mode: C++, Fortran, Linker
COEN 252 Computer Forensics
Thread Programming.
Social Media And Global Computing Using DLLs with MVC
CMSC 202 Exceptions 2nd Lecture.
CMSC 202 Exceptions 2nd Lecture.
CSE 451: Operating Systems Winter 2010 Module 16 Linking, Loading and Process Startup Mark Zbikowski Gary Kimura 1.
CISC124 Assignment 4 on Inheritance due next Friday.
Tonga Institute of Higher Education
CSE 303 Concepts and Tools for Software Development
Writing Large Programs
Module 6: Debugging a Windows CE Image
VIRTUAL FUNCTIONS RITIKA SHARMA.
CSE 451: Operating Systems Winter 2009 Module 16 Linking, Loading and Process Startup Mark Zbikowski Gary Kimura 1.
CMSC 202 Exceptions 2nd Lecture.
Data Structures & Algorithms
Templates Generic Programming.
Following Malware Execution in IDA
Chapter 11 Class Inheritance
Outline Announcements Dynamic Libraries
SPL – PS1 Introduction to C++.
Plug-In Architecture Pattern
Presentation transcript:

Dynamic Link Libraries (DLL)

What it is? DLLs are important structural MS Windows component. code fragments compiled into one library library can be used in multiple programs DLL compared to static library isn’t executable executables can be relatively small DLL creation depends from compiler, but coding is universal

_declspec Keyword which is not a part of ANSI C but most compilers it “understands” It lets to choose various nonstandart options to decide program’s workflow Two main options: _declspec(dllexport) _declspec(dllimport)

dllexport Shows functions available to other programs Otherwise functions will be used only inside library This keyword should be used in function’s prototype as well as in it’s definition

dllimport To be able to use such function it is needed to import this function into program link program with library declare function’s prototype linking is done at compile time!

Macro Can we simplify all that?

DllMain When linking Windows calls DllMain function: APIENTRY – keyword used inside Windows (we can forget it) hInstance – handle to DLL module

reason Value Meaning DLL_PROCESS_ATTACH DLL attaching to program DLL_PROCESS_DETACH DLL detaching from program DLL_THREAD_ATTACH DLL attaching to thread DLL_THREAD_DETACH DLL detaching from thread

reserved If reason is DLL_PROCESS_ATTACH, reserved is NULL for dynamic loads and non-NULL for static loads If reason is DLL_PROCESS_DETACH, reserved is NULL if FreeLibrary has been called or the DLL load failed and non-NULL if the process is terminating

DllMain prototype

Remarks DllMain returns TRUE if library is loaded succsefully Should do almost nothing!

Linking DLL Static – compiler will generate two files: DLL and LIB. LIB file works like small static library specifying for linker to statically link with DLL file. Dynamic – true way to use library to link with during workflow. That’s why plugins and extensions are available.

Dynamic linking LoadLibrary[Ex] SetDllDirectory().

What to do with library? https://msdn.microsoft.com/en-us/library/windows/desktop/ms682599(v=vs.85).aspx LoadResource