65.9K
CodeProject is changing. Read more.
Home

HelloWorld.dll: The simplest way to create your first DLL

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.50/5 (2 votes)

Aug 15, 2012

CPOL
viewsIcon

20211

How to create your first DLL without coding too much... :)

Introduction

This tip is for seriously lazy people who don't take themselves too seriously and want to get over the creation of their first DLL quickly. This is an advanced beginner tutorial, not necessarily recommended for beginners.

Prerequisites 

You need to have the Microsoft Incremental Linker (link.exe). It comes with Microsoft Visual C++ and older MASM32 distributions. If you have Visual C++ installed then the linker is located somewhere around "c:\Program Files (x86)\Microsoft Visual Studio X.0\VC\bin\".

Creating your DLL

Run the following command: 

LINK /OUT:HelloWorld.dll /DLL /NOENTRY /NODEFAULTLIB 

And voila! Congratulations!!! You have created your first DLL! You can load it with LoadLibrary(), and unload it with FreeLibrary(), but demonstrating that is out of the scope of this beginner tutorial.