Building DirectShow Filters

Building DirectShow Filters

The DirectShow base classes are recommended for implementing DirectShow filters. To build with the base classes, perform the following steps, in addition to the steps listed in Setting Up the Build Environment:

  • Build the base class library, located in the directory Samples\Multimedia\DirectShow\BaseClasses, under the SDK root directory. There are two versions of the library: a retail version (Strmbase.lib) and a debug version (Strmbasd.lib).
  • Include the header file Streams.h.
  • Use the __stdcall calling convention.
  • Use the multithreaded C run-time library (debug or retail, as appropriate).
  • Include a definition (.def) file that exports the DLL functions. The following is an example of a definition file. It assumes that the output file is named MyFilter.dll.
        DllMain             PRIVATE
        DllGetClassObject   PRIVATE
        DllCanUnloadNow     PRIVATE
        DllRegisterServer   PRIVATE
        DllUnregisterServer PRIVATE
  • Link to the following lib files.
    Debug BuildStrmbasd.lib, Msvcrtd.lib, Winmm.lib
    Retail BuildStrmbase.lib, Msvcrt.lib, Winmm.lib


  • Choose the "ignore default libraries" option in the linker settings.
  • Declare the DLL entry point in your source code, as follows:
    BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
        return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);

Previous Versions

For versions of the base class library before DirectShow 9.0, you must also do the following:

  • For debug builds, define the preprocessor flag DEBUG.

This step is not required for the version of the base class library that is available in DirectShow 9.0 and later.

Related topics

DirectShow Base Classes
Writing DirectShow Filters



Community Additions

© 2015 Microsoft