VC++ New DLL project humor

I started a little C++ Dll test project this morning and a good start for that is to fire up VS.NET 2003, create a new Win32 project and specify that it is a DLL.

VS.NET creates an initial .cpp file for you with some plumbing code. Here's the code it generated, no editing has been done on my part:

// TestLibrary.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "TestLibrary.h"
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
    return TRUE;
}

// This is an example of an exported variable
TESTLIBRARY_API int nTestLibrary=0;

// This is an example of an exported function.
TESTLIBRARY_API int fnTestLibrary(void)
{
	return 42;
}

// This is the constructor of a class that has been exported.
// see TestLibrary.h for the class definition
CTestLibrary::CTestLibrary()
{ 
	return; 
}
Now, take a good look at function 'fnTestLibrary'. . It's always good to see there are still developers with a good sense of humor around

5 Comments

Comments have been disabled for this content.