Creating a Simple Dynamic-Link Library

The following example, MYPUTS.C, is the source code needed to create a simple DLL, MYPUTS.DLL. The file MYPUTS.C contains a simple string-printing function called myPuts. The MYPUTS DLL does not define an entry-point function, because it is linked with the C run-time library and has no initialization or cleanup functions of its own to perform.

// File: MYPUTS.C.

// The myPuts function writes a null-terminated string to

// the standard output device.

.

#include <windows.h>

VOID myPuts(LPTSTR lpszMsg)

{

DWORD cchWritten;

HANDLE hStdout;

// Get a handle to the standard output device.

hStdout = GetStdHandle(STD_OUTPUT_HANDLE);

// Write a null-terminated string to the standard output device.

while (*lpszMsg)

WriteFile(hStdout, lpszMsg++, 1, &cchWritten, NULL);

}

To build the DLL, follow the directions in the documentation included with your development tools.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database