How To: Create a Dynamic Link Library in VC++ 2005 and include inline ASM

 

Firstly - Create a new C++ Win32 Project.

 

Then select DLL and Empty Project from the Application Settings.

 

From the header files, select Add > New Item

 

 

Select Header File and give it a name asm.h


Fill asm.h with the above code.

Then, from the Source files, select New Item.

 

Select a C++ file and give it a name asm.cpp

 

Enter the above code in the asm.cpp file

 

 

Select to build the solution - remedy any errors you may receive.

 

The build should look like this...

 

 

Now, open a new project, and select Add to Existing Project from the New Project Dialog. Give it a name. I have called mine; win_cpp_asm - copy the above code in the main.cpp source file.

 

From the Project Menu - select Project Dependencies.

 

Select Win32_ASM_DLL as your project dependency.

 

 

Make sure your code looks like this...

 

 

After successfully compiling your project - go to the Project Release folder. (If you selected Release as a build option)

This is my DOS view of the folder I released inside.

 

I create a file called 'infile.txt' and put a cool Xander is a Haxor inside it and save it.

 

 

Now, I run the program, and enter the encryption code 100.

 

 

As you can see, an outfile.txt was created.

 

This is the contents of the outfile.txt - Xander is a Haxor had been encypted!

 

This is how you create a DLL in Visual C++ 2005 and import the DLL for use in to a C++ Project.