Thread: whats the difference between a DLL and class file in C++

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    192

    whats the difference between a DLL and class file in C++

    Hi Im trying to make a DLL but everytime Im looking for tutorials its kinda looks like im making a class. Because mostly I get a header file then a cpp file and its suppose to make a dll file? I'm not really sure how to get a dll file out of the .cpp and .h files

  2. #2
    Registered User
    Join Date
    Jul 2007
    Posts
    43
    Each compiler is probably a bit different, its probably similar to compiling an exe but just a different setting or command line option. What compiler?

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    DLLs are a Windows thing. Classes are a C++ thing. DLLs can be comprised of a DLLMain, classes, C functions, structures, etc. that can be exported so that external users can utilize the code in the DLL. On the surface a DLL doesn't look much different than normal source code except for the export statements in the class and/or C function declarations. DLL's do not have a main but can have a DLLMain that is called. There are several 'reasons' that DLLMain is called and those are explained in the Windows SDK.

    In MSVC you set your project options so that it builds a DLL. Any pieces of the code you export will be in the .exp file as well as the export library that is generated for your DLL. You can use this export library to link to in other projects for somewhat 'static' linking or you can use LoadLibrary() and GetProcAddress() to dynamically load and link to the DLL at runtime.

    Note that LoadLibrary() will not load managed DLLs.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proper DLL class interfaces
    By Magos in forum C++ Programming
    Replies: 10
    Last Post: 02-24-2006, 03:41 AM
  2. Using class with DLL
    By greg2 in forum C++ Programming
    Replies: 2
    Last Post: 09-12-2003, 05:24 AM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  4. DLL class member functions
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 07-11-2003, 06:59 AM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM