Thread: Im really confused about DLLs, so can anyone help?

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    Question Im really confused about DLLs, so can anyone help?

    I have no idea how to create DLLs or how theyre used? How do you load one in an application? How do you create one?(Borland command line compiler) If they store functions, why cant you just use a header file? Thanks for the help !!!
    Do not make direct eye contact with me.

  2. #2
    1479
    Join Date
    Aug 2003
    Posts
    253
    I honestly can't tell you cause I don't know a thing about it, but you can always find help either on this board just do a google search.

    I found this thread that may help you to some extent.

    http://cboard.cprogramming.com/showt...&highlight=dll
    Knowledge is power and I want it all

    -0RealityFusion0-

  3. #3
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    dlls are linked at run time. They can be used by multiple applications, and are only stored once.

    Stuff in header files finds its way into the final .exe - making the .exe bigger. It also can't be reused by another program without including it all again - meaning that it will end up being stored twice, in two big exes.

    Think of it like this:

    with dlls:
    two little exe files, and one dll
    without dlls:
    two big exe files
    Away.

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Just to get a tad more specific (on the search):

    http://cboard.cprogramming.com/searc...der=descending

    *Note*: I noticed this is not in the new FAQ. If i knew anything on the topic i would create a section for it, but i dont. Maybe someone can write a DLL section for the FAQ and send it to hammer?

  5. #5
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Well, dll's are windows dynamic link libraries. Hence, since they are windows oriented, they are not a part of the standard library. So everything I mention here is nonstandard and won't be portable (without modifications).

    Basically, a dll contains compiled code, similar to an exe. However, unlike an exe, multiple programs can use the code in a dll. It is just a matter of loading the dll. This is done through pLoadLibraryEx. Once you load the dll, you must load each function into a function pointer. This is done by calling GetProcAddress. Once the function is loaded into the function pointer, the function pointer can be used just like any function.


    When creating a dll in C++, there are some special calling conventions you must follow. In C++, when you compile code, the compiler "mangles" the name of the functions, variables, etc. As a result, if the names were mangled in a dll, the exe calling the dll wouldn't be able to find the function. Hence, the funky extern "C" stuff.


    EDIT: Make sure you call [url="http://msdn.microsoft.com/library/en-us/dllproc/base/freelibrary.asp?frame=true"]FreeLibrary when you are done using a dll in your program.
    Last edited by golfinguy4; 08-08-2003 at 10:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Some doubts on DLLs
    By BrownB in forum Windows Programming
    Replies: 1
    Last Post: 05-30-2007, 02:25 AM
  2. standart dlls
    By keeper in forum C++ Programming
    Replies: 3
    Last Post: 07-05-2006, 07:32 PM
  3. Can't load string from resource DLL's string table
    By s_k in forum Windows Programming
    Replies: 4
    Last Post: 07-15-2003, 06:43 AM
  4. question about DLL's and class functions
    By btq in forum Windows Programming
    Replies: 2
    Last Post: 02-25-2003, 06:08 AM
  5. DLLs <- sound files, and nesting.
    By sean in forum C++ Programming
    Replies: 2
    Last Post: 10-28-2002, 05:13 PM