Microsoft DirectX 8.0 (C++)

D3DXCompileEffectFromFileA

Compiles an effect from a file specified by an ANSI string.

HRESULT WINAPI D3DXCompileEffectFromFileA(
  LPCSTR        pSrcFile,
  LPD3DXBUFFER* ppCompiledEffect,
  LPD3DXBUFFER* ppCompilationErrors
);

Parameters

pSrcFile
[in] Pointer to an ANSI string that specifies the file from which to create the effect.
ppCompiledEffect
[out, retval] Address of a pointer to an ID3DXBuffer interface, containing the compiled effect.
ppCompilationErrors
[out, retval] Address of a pointer to an ID3DXBuffer interface, containing the returned ASCII error messages.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.

D3DERR_INVALIDCALL
D3DXERR_INVALIDDATA

Remarks

After an effect is compiled, use D3DXCreateEffect to obtain a pointer to a ID3DXEffect interface.

D3DXCompileEffectFromFile maps to either D3DXCompileEffectFromFileA or D3DXCompileEffectFromFileW, depending on the inclusion or exclusion of the #define UNICODE switch. Include or exclude the #define UNICODE switch to specify whether your application expects Unicode or ANSI strings. The following code fragment shows how D3DXCompileEffectFromFile is defined.

#ifdef UNICODE
#define D3DXCompileEffectFromFile D3DXCompileEffectFromFileW
#else
#define D3DXCompileEffectFromFile D3DXCompileEffectFromFileA
#endif

Requirements

  Header: Declared in D3dx8effect.h.
  Import Library: Use D3dx8.lib.

See Also

D3DXCompileEffect, D3DXCompileEffectFromFileW, D3DXCreateEffect