Thread: making a dll

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    A basic dll has only one function -- DllMain() which is similar to main() in a normal C/C++ program. And you compiler will generate the code for that. You will want to manually create a header file that contains the prototypes of the functions you want to export. This is for other C/C++ programs that will use your dll, but won't probably need it for VB6. I don't know how you will declare the function in VB6.

    This will export one function -- foo().

    Code:
    // This is the C source file
    // includes here
    #include <all includes here>
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    __declspec( dllexport ) int foo()
    {
       return 0;
    
    }
    #ifdef __cplusplus
    }
    #endif
    Last edited by Ancient Dragon; 04-04-2006 at 03:41 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL Making and Symbols - 2 Queries
    By Tronic in forum C++ Programming
    Replies: 9
    Last Post: 12-31-2004, 01:11 AM
  2. C++ .NET - "inconsistent dll linkage" - What's that?
    By BrianK in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2004, 10:16 AM
  3. Using class with DLL
    By greg2 in forum C++ Programming
    Replies: 2
    Last Post: 09-12-2003, 05:24 AM
  4. DLL & free() Heap Access Violation
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 08-13-2002, 10:45 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM