Categories
Geeky/Programming

HowTo: Make a Win32 DLL without MFC and ATL

Vs2005->New->Project

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!

Steve Novoselac's avatar

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.

Like

Leave a reply to Aaron Ballman Cancel reply

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