Code Examples
  Home arrow Code Examples arrow Page 6 - Dynamic Link Libraries Inside-Out
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

Dynamic Link Libraries Inside-Out
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 55
    2004-09-15

    Table of Contents:
  • Dynamic Link Libraries Inside-Out
  • Advantages and Disadvantages of Using DLLs
  • What Does the DLL Contain?
  • The DLL Entry Point Function: DllMain
  • Types of DLL Linking
  • Resource Only DLLs
  • Dynamic Link Library Redirection
  • Points of Interest
  • Troubleshooting and Common Errors

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Dynamic Link Libraries Inside-Out - Resource Only DLLs


    (Page 6 of 9 )

    Usually a dynamic link library would contain many exports that other programs use. However, a DLL may choose not to export even a single function. Why would such a DLL ever be created? The answer is resources and their use in localization.

    Let's say you're working on a Windows application that needs to be deployed in many languages. Normally you would write all the menus, static strings in the native language you work in, but what if the application should have a capability to be customizable in terms of the language of operation. One solution could be to make separate resources for each, but that’d take a lot of effort on the developer’s part and obviously not a good solution. Another solution could be to put all the strings and menus etc. that need to be localized are kept in a DLL and you just modify the resources to make it in a different language. And on the users demand choose the appropriate DLL and use those resources in an application. Here comes the use for resource only DLLs.

    DLLs and Function Forwarding

    You may choose to delegate handling of the functions exported from your DLL (but not implemented) to implementation in some other DLL. This is called function forwarding.

    You can do so just by making an entry in your import definition (.def) file which mentions the original function and its ordinal number as:

    SCardAccessNewReaderEvent = original.SCardAccessNewReaderEvent @1

    This is a function exported by WinSCard.dll. While doing so you’ll need to forward all the functions which the original library exports. It means a lot of work. So you’d ask, “Why do I need something like that?” The answer is if you need to override the default behavior of a few functions of a DLL where you don’t have the source code to it …….. You may use this technique. DLL function hooking is another way which is more complicated, and here are we doing it the simple but hard way. So you just forward all the functions other than you need to override and just rename the original DLL to something like xyz.dll and provide an entry for each overridden and forwarded function. So a function Foo1 overriden and Foo2 forwarded your def file will have the entries like:

    Foo1 private  @1
    Foo2  = xyz.Foo2 @2

    And you’re done. Now after doing the processing in your defined Foo1 you may or may not choose to call the xyz.Foo1 function based on your design.

    More Code Examples Articles
    More By Digvijay Chauhan


       · hi,Its Ravi Verma from India. This article on dll is really a master piece....
       · hi,Its Ravi Verma from India. This article on dll is really a master piece....
       · hey you indian,you have my job. stop outsourcing now
       · Where are the pictures in this article?Best RegardsHolland
       · I Jon't have a job either
       · Companies hire only talented deserving people......
       · Yes very True,That's why 'I QUIT' and don't have a job. They don't know how to...
       · the article could have been better if mapping of dll to address space have been...
       · Great article, thanks for sharing...
     

    CODE EXAMPLES ARTICLES

    - Handling Animations and Bitmaps Using GDI+ f...
    - Download a Web Page using the WebClient
    - Creating a Chart using Data from a Database ...
    - The Basics of Charting with the MS Chart Con...
    - Searching Body Text with textRange: Enter th...
    - Searching Body Text with textRange: Building...
    - Searching Body Text with textRange, part 1: ...
    - First Steps in Programming
    - Programming in C
    - Quick Introduction to ASF,ASX, and Networkin...
    - SatView: Pointer Perfect, Part 2: Constructi...
    - SatView: Pointer Perfect, Part 1
    - Style Case Studies: Construction Unions
    - Creating an Engine for Games for Windows
    - Style Case Studies: Generic Callbacks





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway