nmake: build DLL


  • Does anyone know the command in Makefiles to build DLLs using nmake? Also, are there any good references or books out there that tell you how to use nmake? Any wisdom shed here would be much appreciated.

    Friday, March 07, 2008 2:19 AM


  • Hi,


    NMAKE builds the source files based on the commands contained in your make file.

    Thus, to produce a dll with NMAKE, just add the commands for building a DLL to the Makefile. Generally, we use cl command line to do this. For example, if you have a dll source file as:

    Code Snippet

    __declspec(dllexport) int __cdecl Add(int a, int b)


       return a+b;




    Assume you save it to “D:\Add.cpp”, then you can create a makefile as follows


    Code Snippet


     cl "D:\Add.cpp" /link /DLL /out:Add.dll




    And then produce the DLL through the NAMKE tool with above make file.


    This is just a sample; the Makefile is generally more complex.

    For detail information, you can refer to


    Hope this helps!


    Wednesday, March 12, 2008 9:57 AM