user2824183
user2824183

Reputation: 31

Unable to import MFCreateDXSurfaceBuffer function

I am working on some video editing software and need to use some Direct3D components to improve performance. Specifically, I need to use the MFCreateDXSurfaceBuffer function to create samples from a direct3d surface. After adding code to use this function, I get the following message when trying to run the compiled executable:

The procdedure entry point MFCreateDXSurfaceBuffer could not be located in the dynamic link library MFPlat.dll

Output window: The program '[0x1C04] ClassLibrary1.exe: Native' has exited with code -1073741511 (0xc0000139) 'Entry Point Not Found'.

I created a minimalistic project that reproduces the problem:

#include < mfapi.h >
#include < d3d9.h >
#include < evr.h >

static void
Fail
    (
    )
{
    IDirect3DSurface9* theSurface = nullptr;
    IMFMediaBuffer* theBuffer = nullptr;
    MFCreateDXSurfaceBuffer(__uuidof(IDirect3DSurface9), theSurface, FALSE, &theBuffer);
}

int main()
{
    Fail();
}

I added "evr.lib;mfplat.lib;D3d9.lib" to Properties->Linker->Input Additional dependencies

I am using:

What I've tried:

  • Google - no mention of a similar problem
  • Ran the code on a co worker's machine. Same issue occurs.
  • Call other functions from evr.dll. Some work, some have the same problem
  • Dependency Walker: mini project EXE Depends on MFPLAT.DLL, MSVCR110D.DLL and KERNEL32.DLL.
  • Error message:

    "At least one module has an unresolved import due to a missing export function in an implicitly dependent module."

    Obviously, the function that did not import was MFCreateDXSurfaceBuffer. You may have noticed that MFCreateDXSurfaceBuffer is defined EVR.dll, which is conspicuously absent from my dependency list.

    Why is the function failing to import and how do I fix it?

    Upvotes: 3

    Views: 1946

    Answers (3)

    Nihilist
    Nihilist

    Reputation: 1

    After coming across this problem, I searched the library files in the Windows SDK directory and found a .lib file that exports the MFCreateDXSurfaceBuffer function. The file is called evr_vista.lib.

    I have no clue why EVR functions have been split into the evr.lib and evr_vista.lib.

    Adding "evr_vista.lib" in addition to "evr.lib" to the list of libraries to link with should resolve any linking errors.

    Under Visual Studio:

    Project Properties > Configuration Properties > Linker > Input > Additional Dependencies

    Upvotes: 0

    &#201;van
    &#201;van

    Reputation: 21

    I'm also facing this issue. For the record, I'm writing the solution I found here :

    HMODULE evrModule = LoadLibraryA("evr.dll");
    
    /* MFCreateDXSurfaceBuffer prototype */
    typedef HRESULT(STDAPICALLTYPE *MFCDXSB)(_In_ REFIID iid, _In_ IUnknown *unkSurface, _In_ BOOL bottomUpWhenLinera, _Out_ IMFMediaBuffer **mediaBuffer);
    
    MFCDXSB pMFCreateDXSurfaceBuffer = (MFCDXSB)GetProcAddress(evrModule, "MFCreateDXSurfaceBuffer");
    

    Do not forget to check for errors and to call FreeLibrary(evrModule) at the end

    I tried several things and they all failed. I know this is a bit hardcore but at least it works and I only do this for this method so I guess it's ok.

    Upvotes: 2

    Roman Ryltsov
    Roman Ryltsov

    Reputation: 69632

    The procdedure entry point MFCreateDXSurfaceBuffer could not be located in the dynamic link library MFPlat.dll

    MFCreateDXSurfaceBuffer function is exported off evr.dll, not mfplat.dll - you already discovered this. I suppose you might be using some wrong/corrupt Windows SDK version. At least with Windows SDK 7.0 the code builds and starts fine. Besides the code snippet quoted above you only need to add evr.lib as additional linker input.

    Upvotes: 2

    Related Questions