CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Creating a DLL

  1. #1
    Guest

    Creating a DLL

    Hi,
    I am trying to create my first DLL and I would be interested in any suggestions on where to get information on creating a DLL. If anyone knows of any
    books/web sites where I can find tutorials/examples in C/C++ please let me know.

    Thanks
    Chad


  2. #2
    Join Date
    May 1999
    Posts
    28

    Re: Creating a DLL

    Try www.msdn.microsoft.com
    Then choose "library"
    Then do a normal search for your topic
    LOTS of info there


  3. #3
    Join Date
    Jun 1999
    Posts
    3

    Re: Creating a DLL, another help request!

    I've gone through MSDN and drove myself quite mad with MFC references and such. I am looking for a basic, "Hello World" DLL example to understand the process. Currently using VC5.0 in Win98, I am not a Windows programmer. Any help would contribute greatly to maintaining the sanity of another human being, let your altruistic side go, just don't let the Objectivists know!

    TIA


  4. #4
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Creating a DLL, another help request!

    Check out the MFC samples DLLHUSK and DLLTRACE.
    It might also help for you to place some TRACE statements in the
    DllMain function of the library so you can see when and why DllMain
    is called. This can be very enlightening. There are also several
    articles in the DLL section of this site that are worth checking out.

    Just for giggles, here is a basic DllMain function that you can start with.
    I'll also throw in one exported function. Make a little testing app to call
    this function and watch the debug output. The app wiz can generate
    projects for the app and the DLL for you.


    BOOL WINAPI DllMain( HINSTANCE hInstDll, DWORD dwReason, LPVOID lpReserved )
    {
    switch( dwReason )
    {
    case DLL_PROCESS_ATTACH :
    TRACE( "DllMain - DLL_PROCESS_ATTACH\n" );
    break;

    case DLL_PROCESS_DETACH :
    TRACE( "DllMain - DLL_PROCESS_DETACH\n" );
    break;

    case DLL_THREAD_ATTACH :
    TRACE( "DllMain - DLL_THREAD_ATTACH\n" );
    break;

    case DLL_THREAD_DETACH :
    TRACE( "DllMain - DLL_THREAD_DETACH\n" );
    break;
    }
    return TRUE;
    }


    #define DllExport __declspec(dllexport)

    DllExport int TestFunction( int iarg )
    {
    TRACE( "TestFunction called with argument %d\n", iarg );
    return 0;
    }





    Post again if you have more questions.



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

Featured