Results 1 to 10 of 10

Thread: Few questions about DLL's

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Few questions about DLL's

    These are probably easy, but since I have no idea:

    1. What exactly is a DLL?
    2. What are DLL's used for?
    3. How do you make one?
    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    A DLL is a file that contains functions. For example all the api functions are inside dll's. Dll's are used for more organised code and for smaller exes.

    To make one go to new project and choose win32 dynamic link library.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    So if I had an exe and a dll, I can have my functions in the dll and when I change something I can just send a user the dll?
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Well, it depends of the changes, but generaly you can do that.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Ok, one more question, how do you call the functions inside the DLL?
    Alcohol & calculus don't mix.
    Never drink & derive.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You can also use Load-TIme Dynamic Linking:
    Using Load-Time Dynamic Linking
    After you have created a DLL, you can use it in an application. The following file, LOADTIME.C, is the source code for a simple console application that uses the myPuts function exported from MYPUTS.DLL.

    // File: LOADTIME.C.
    // A simple program that uses myPuts from MYPUTS.DLL.

    #include <windows.h>

    VOID myPuts(LPTSTR); // a function from a DLL

    VOID main(VOID)
    {
    myPuts("message printed using the DLL function\n");
    }

    Because LOADTIME.C calls the DLL function explicitly, the module for the application must be linked with the import library MYPUTS.LIB. For more information about building DLLs, see the documentation included with your development tools.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  8. #8

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Parksie, two things:
    1. When I try to compile this code, I get this link error: "LINK : fatal error LNK1104: cannot open file 'mylib.lib'". Isn't that what I am compiling? Also, when I take mylib.lib out of the project settings i get unresolved external link errors.

    2. In loadlib.cpp, where you have the function pointers and finding the function, do I have to do that for every function I write?
    Alcohol & calculus don't mix.
    Never drink & derive.

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    1. MyLib.lib is generated when you compile the DLL project, not the test program

    2. Yes - however this would normally happen when your program was initialised so you only need to use the function call.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  10. #10

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Ok, thanks a lot for the help and the project
    Alcohol & calculus don't mix.
    Never drink & derive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width