HowTo: Make a Win32 DLL without MFC and ATL


Win32->Win32 Project

On the Wizard, Application Settings, choose DLL radio box, hit finish.

This is all great, except when you build it, you just end up with a dll. How do you use the dll in another project?

Add a Module-Definition File (.def) – call it Export.def

next time you build, there will be a “.lib” file avail so you can link in the dll with another project.

You can add a EXPORTS section to export functions. The LIBRARY secion is added for you automatically. Have Fun with your new Win32 dll!

By Steve Novoselac

Director of Digital Technology @TrekBikes, Father, Musician, Cyclist, Homebrewer

One reply on “HowTo: Make a Win32 DLL without MFC and ATL”

Generally speaking, you can skip the separate def file by using extern “C” blocks around your function declarations. Since only C linkage is allowed in dlls, this tells the compiler that the function is really a C function (not just a global C++ function) and so it will automatically export.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.