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!

Advertisements

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

  1. 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

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s