This is an attempt to demonstrate how a DLL can be created whose functions are called in a console (such as cmd.exe or PowerShell) via rundll32.exe).
EntryPoint
A (32-bit) function that can be called with rundll32.exe must be declared with stdcall calling convention. Apparently, this can be achieved with the CALLBACKmacro:
void CALLBACK EntryPoint (HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int nCmdShow); // Windows 95 etc.
void CALLBACK EntryPointW(HWND hWnd, HINSTANCE hInst, LPWSTR lpszCmdLine, int nCmdShow); // Windows NT, 2K XP etc.
Under Windows NT and similar, rundll32.exe first tries to locate EntryPointW (using LPWSTR), then EntryPointA (using LPSTR) and then EntryPoint (again using LPSTR).
Source file
The following C source file exposes three functions: func_1, func_1W and func_2 according to the EntryPoint specification given above;